基于pg 9.4,有如下表,data是jsonb型別。
CREATE TABLE users (
id serial PRIMARY KEY,
data jsonb
);
INSERT INTO "public"."users" VALUES ('1', '{"Address": {"City": "Skopje", "Country": "Macedonia"}, "LastName": "Doe", "FirstName": "John"}');
然后根據官方檔案https://www.postgresql.org/docs/current/functions-json.html的jsonb_insert函式,
,我想要在data欄位里再插入一個key,value,執行如下sql:
UPDATE users
SET DATA = jsonb_set (DATA, '{Age}', '"30"', TRUE)
WHERE
ID = 1;
報錯:
[Err] ERROR: function jsonb_set(jsonb, unknown, unknown, boolean) does not exist
LINE 2: SET DATA = jsonb_set (DATA, '{Age}', '"30"', TRUE)
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
希望各位回答一下。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/69885.html
標籤:PostgreSQL
上一篇:關于redis專案常用的模塊
