Re: getting rid of "Adding missing FROM-clause entry...." - Mailing list pgsql-sql

From Manfred Koizar
Subject Re: getting rid of "Adding missing FROM-clause entry...."
Date
Msg-id 6ijt9vgiapkddv4o7cvj9rjprbmdkkcd8b@4ax.com
Whole thread Raw
In response to Re: getting rid of "Adding missing FROM-clause entry...."  (Rajesh Kumar Mallah <mallah@trade-india.com>)
List pgsql-sql
On Thu, 17 Apr 2003 21:22:17 +0530, Rajesh Kumar Mallah
<mallah@trade-india.com> wrote:
>BTW any idea why the query which i posted is not
>working? and issuing a NOTICE.

I guess, in 
UPDATE t1   SET ...  FROM (SELECT ... FROM t2        WHERE t2.id = t1.id);

the subselect is not correlated because t1 and the subquery are on the
same level.  So the subquery is treated like a standalone query and as
it does not have t1 in its FROM clause, t1 is added automatically.
Then the result of the subquery is joined to each row of t1 for the
update.  This also explains why all rows were updated to the same
values.

ServusManfred



pgsql-sql by date:

Previous
From: Rajesh Kumar Mallah
Date:
Subject: Re: getting rid of "Adding missing FROM-clause entry...."
Next
From: Tom Lane
Date:
Subject: Re: analyse question..