I have a table containing a data that look like:
col1 col2 col3 col4 json_data
----------------------------------------------------
a b c d {"mock":"abc123"}
e f g h {"mock":"def456"}
The column json_data is a column with jsonb type that contains some json that do not relate to anything which I want to update with row_to_json() function. The result should be something like this
col1 col2 col3 col4 json_data
----------------------------------------------------
a b c d {"col1:"a", "col2:"b","col3:"c","col4:"d"}
e f g h {"col1:"e", "col2:"f","col3:"g","col4:"h"}
which will get the result from row_to_json function to update each row. I am not sure how can I use the UPDATE query to do this.