Updating JSON object value in column

Hello, Im trying to wrap my head around how to update a JSON column were I want to update the value not by replacing the whole object but by setting the specific field in the JSON using:
set metadata = jsonb_set(metadata, '{root,nested}', '"value"');

OR
set metadata = jsonb_set(metadata, array['root','nested'], '"value"');
set metadata = jsonb_set(metadata, '{root,nested}', '"value"');

OR
set metadata = jsonb_set(metadata, array['root','nested'], '"value"');
however im trying this and its erroring out
.updateTable('table')
.set({
metadata: sql`jsonb_set(metadata, '{root,nested}', '"${value}"');`,
})
.updateTable('table')
.set({
metadata: sql`jsonb_set(metadata, '{root,nested}', '"${value}"');`,
})
[Error] API error: PostgresError: could not determine data type of parameter $1
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server