I’m trying to add a property to an existing jsonb
column (column "data").
I want have my jsonb
document to log like this
{
// ... existing properties
"Filed": false // new property
}
I tried
UPDATE "doc" SET "data" = jsonb_set("data"::jsonb, 'Filed', false, true)
I get this error:
[42883] ERROR: function jsonb_set(jsonb, unknown, boolean, boolean) does not exist
Hint: No function matches the given name and argument types.
You might need to add explicit type casts. Position: 46
2
Answers
Better use the
||
operator.This one is equivalent but more suitable for parameterization:
It should be
The second parameter is an array denoting the path to the appropriate key, and
'false'
is the string representation of a JSON boolean.