Home > database >  Postgresql jsonb query update problems, jsonb_insert function
Postgresql jsonb query update problems, jsonb_insert function

Time:09-23

Based on pg 9.4, there is the following table, the data is jsonb type,
The CREATE TABLE users (
Id serial PRIMARY KEY,
Data jsonb
);

INSERT INTO "public". "the users" VALUES (' 1 ', '{" Address ": {" City" : "Skopje," "Country" : "Macedonia"}, "LastName" : "Doe", "FirstName" : "John"} ");

Then, according to official document jsonb_insert function of https://www.postgresql.org/docs/current/functions-json.html,
, I want to insert a key in the data field, value, execute the following SQL:

UPDATE the users
The SET DATA=https://bbs.csdn.net/topics/jsonb_set (DATA, '{Age}', '" 30 ", TRUE)
WHERE
ID=1;
Error:
(Err) ERROR: function jsonb_set (jsonb, unknown, unknown, Boolean) does not exist
LINE 2: the SET of DATA=https://bbs.csdn.net/topics/jsonb_set (DATA, '{Age}', '" 30 ", TRUE)
^
HINT: No function matches the given name and argument types. You took the need to add explicit type casts.

I hope you answer,

  • Related