Re: Support UPDATE table SET(*)=... - Mailing list pgsql-hackers

From Marti Raudsepp
Subject Re: Support UPDATE table SET(*)=...
Date
Msg-id CABRT9RAaA44A=7O8armYFmmXoRTW_0P20acazTdds_=_hoGWJA@mail.gmail.com
Whole thread Raw
In response to Re: Support UPDATE table SET(*)=...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
<p dir="ltr"><br /> On Oct 17, 2014 6:16 PM, "Tom Lane" <<a
href="mailto:tgl@sss.pgh.pa.us">tgl@sss.pgh.pa.us</a>>wrote:<br /> > A more realistic objection goes like
this:<br/> ><br /> > create table foo(f int, g int);<br /> > update foo x set x = (1,2);  -- works<br /> >
altertable foo add column x int;<br /> > update foo x set x = (1,2,3);  -- no longer works<br /> ><br /> >
It'snot a real good thing if a column addition or renaming can<br /> > so fundamentally change the nature of a
query.<pdir="ltr">I think a significant use case for this feature is when you already have a row-value and want to
persistit in the database, like you can do with INSERT:<br /> insert into foo select * from
populate_record_json(null::foo,'{...}');<p dir="ltr">In this case the opposite is true: requiring explicit column names
wouldbreak the query if you add columns to the table. The fact that you can't reasonably use populate_record/_json with
UPDATEis a significant omission. IMO this really speaks for supporting shorthand whole-row assignment, whatever the
syntax.<pdir="ltr">Regards,<br /> Marti 

pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Vitesse DB call for testing
Next
From: Bruce Momjian
Date:
Subject: Hash index creation warning