postgresql error while using column values in jsonb_set function

I am trying to update a field value in jsonb column with text value present in another column but getting some syntax errors; not getting any solution.

i am trying to swap values of OutgoingVertexid & IncomingVertexId in below JSONB

'{
   "Owner":[
      {
         "Edgeid":10,
         "Weight":100,
         "Active":1,
         "OutgoingVertexid":"",
         "IncomingVertexid":"G",
         "EdgeColor":"Black"
      }
   ]
}'

so used below code by putting all values OutgoingVertexid & IncomingVertexid value in temp table.

UPDATE temp_table 
        SET 
        owner_property = CASE 
                            WHEN owner_outgoing_edge IS NOT NULL 
                                THEN jsonb_set(owner_property, '{OutgoingVertexid}', '""')
                            ELSE 
                                jsonb_set(owner_property, '{OutgoingVertexid}', ''||owner_incoming_edge::jsonb||'') 
                                END;

but getting below error:

ERROR: invalid input syntax for type json LINE 7: … jsonb_set(owner_property, ‘{OutgoingVertexid}’, ”””||ow… ^ DETAIL: Token “‘” is invalid.

If

Thanks in Advance

Go to Source
Author: VBAGuy