select rooms from users where username='test_user';
**returns** {"roomID":[{"1":"test1"}]}
I want to add to[{"1":"test1"}] this {"2": "test2"} --> [{"1":"test1"}, {"2": "test2"}]
My current attempt is this.
UPDATE users
SET rooms=(
(select rooms from users where username='test_user')::json
-> 'roomID' || '{"2": "test2"}' ::json
)
WHERE username='test_user'
RETURNING *
;
Messages ERROR: operator does not exist: json || json LINE 4: -> 'roomID' || '{"2": "test2"}' ::json