Re: Why the "UPDATE tab SET tab.col" is invalid? - Mailing list pgsql-hackers

From Geoff Winkless
Subject Re: Why the "UPDATE tab SET tab.col" is invalid?
Date
Msg-id CAEzk6ffXhvYhJ-51vNuLUZ5Dv57igqwz6GCxFNXj6wFfvZFmPQ@mail.gmail.com
Whole thread Raw
In response to Re: Why the "UPDATE tab SET tab.col" is invalid?  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: Why the "UPDATE tab SET tab.col" is invalid?  (Geoff Winkless <pgsqladmin@geoff.dj>)
List pgsql-hackers
On 7 April 2016 at 14:48, Merlin Moncure <mmoncure@gmail.com> wrote:
>
> On Thu, Apr 7, 2016 at 4:39 AM, postgres_sure <postgres_sure@163.com> wrote:
> > Hi,
> >
> > 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.
>
> Is this syntax described in the SQL standard?

Given that the SQL standard has no concept of UPDATEs against a query
with multiple tables, and that's where this could bring the most
clarity, I'm not sure that it's reasonable to object on that basis.

As far as I can see the SQL standard doesn't let you alias tables in
an UPDATE (for the same reason, I imagine) but we allow _that_ even in
a single-table UPDATE.

<update statement: positioned> ::=             UPDATE <table name>               SET <set clause list>
WHERECURRENT OF <cursor name> 


Geoff



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Performance improvement for joins where outer side is unique
Next
From: Geoff Winkless
Date:
Subject: Re: Why the "UPDATE tab SET tab.col" is invalid?