0

I have a table world with a field v (jsonb) and workflow_id (int). I want to run the command: UPDATE world SET v = {'a': 1} WHERE workflow_id = 84; This gives me a syntax error - I've tried putting quotation marks around the json value in all of the different combinbations I can think of but nothing works. If I try "{'a':1}", it tells me that column "{'a':1}" does not exist.

Any help would be appreciated.

1

1 Answer 1

2

Try

UPDATE world SET v = '{"a": 1}::jsonb' WHERE workflow_id = 84;

cause you need to cast your text to jsonb datatype.

else you can also try

UPDATE world SET v = CAST('{"a": 1}' AS JSONB) WHERE workflow_id = 84;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.