On 8/3/26 12:09 AM, Färber, Franz-Josef (StMUK) wrote:
Dear Postgres Community,

cf. https://www.postgresql.org/docs/current/sql-update.html :

As far as I understand, I can

* UPDATE myTable SET col1 = val1, col2 = val2, ...
* UPDATE myTable SET (col1, col2, ...) = <ROW-or-subselect>

But I cannot, and I am missing that:
* UPDATE myTable SET (myTable.*) = <ROW-or-subselect>
* UPDATE myTable SET (col1, col2, ...) = json_populate_record(NULL::myTable, 
myJson)   -- this is a function, not a ROW construct and not a subselect

Make it a subselect? Not tested but:

UPDATE myTable SET (col1, col2, ...) = (select * from json_populate_record(NULL::myTable, myJson))


This would be useful for some of my trigger code.


Regards,
fjf2002





--
Adrian Klaver
[email protected]


Reply via email to