On Mon, Aug 3, 2026 at 4:19 AM Färber, Franz-Josef (StMUK) < [email protected]> 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 > What you *can* do is insert from json_populate_record, then write an ON CONFLICT clause to set the rest of the columns. It's possible to do this in a generic way with dynamic SQL if you assume that you are matching the table's primary key and the rest of the columns are to be updated. As others mentioned, SQL doesn't really have this, but if you are very proficient with pl/pgsql you can work around it. merlin
