Re: Why the "UPDATE tab SET tab.col" is invalid?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "postgres_sure" <postgres_sure(at)163(dot)com>
Cc: "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why the "UPDATE tab SET tab.col" is invalid?
Date: 2016-04-07 13:42:47
Message-ID: 1466.1460036567@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"postgres_sure"<postgres_sure(at)163(dot)com> writes:
> I found "Do not include the table's name in the specification of a target column
> for example, UPDATE tab SET tab.col = 1 is invalid." in the documentation.

> Some people usually like to update table by alias. They want to add this feature.

Sorry, but we aren't ever going to accept such a patch, because it would
introduce an unavoidable ambiguity: is "SET a.b = " meant to be an
assignment to column b of table a, or is it meant to be an assignment to
sub-field b of composite column a?

Yeah, we could invent some resolution rules to deal with that, but
better to just not add the nonstandard syntax (and it IS nonstandard,
SQL:2011 has nothing about it) in the first place.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-04-07 13:46:27 Re: pgbench randomness initialization
Previous Message Andres Freund 2016-04-07 13:41:58 Re: Move PinBuffer and UnpinBuffer to atomics