【问题标题】:Postgres inner json updatePostgres内部json更新
【发布时间】:2020-12-16 09:20:46
【问题描述】:
{
    "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?

【问题讨论】:

  • 欢迎来到 SO!请阅读游览tourHow to Ask 一个问题。如果您提供更多信息,您更有可能得到有用的答案。

标签: sql json postgresql


【解决方案1】:

你可以像这样使用jsonb_set()

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-17
    • 1970-01-01
    相关资源
    最近更新 更多