簡體   English   中英

Postgres 內部 json 更新

[英]Postgres inner json update

{
    "travel": {
        "arrival": {
            "time": "2020-09-03T10:05:00.000Z",
            "type": "Contract",
            "driver": "saman",
            "provider": "ideal",
            "vehicleno": null
        },
        "departure": {
            "time": "2020-09-03 16:55",
            "type": "Contract",
            "driver": "saman",
            "provider": null,
            "vehicleno": null
        }
    },
    "serviceend": "2020-09-03T11:15:00.000Z",
    "costsheetno": "AA 67856",
    "servicestart": "2020-09-03T10:10:00.000Z"
}

如何設置costsheet->'travel'->'departure'->'time'=null?

您可以像這樣使用jsonb_set()

jsonb_set(costsheet, '{travel,departure,time}', 'null')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM