表有一個名為“stats”的 json 列,其值如下:{“countValue”:0}
我正在嘗試通過以下方式更新此值:
UPDATE my_table
SET stats = jsonb_set(stats, '{countValue}', 1);
但收到以下錯誤:
No function matches the given name and argument types. You might need to add explicit type casts.
我試圖通過對 countValue (countValue::text) 應用顯式型別轉換來解決這個問題,但結果相同。
我究竟做錯了什么?
uj5u.com熱心網友回復:
您可能需要在函式簽名中使用 jsonb 型別'1'而不是整數jsonb_set
jsonb_set(target jsonb, path text[], new_value jsonb [, create_missing boolean])
UPDATE my_table
SET stats = jsonb_set(stats, '{countValue}', '1');
sqlfiddle
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/450555.html
標籤:json PostgreSQL
上一篇:按年份的最高發生率對事件進行排序
