X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9A0E34758F1 for ; Thu, 17 Apr 2003 12:02:14 -0400 (EDT) Received: from email04.aon.at (WARSL401PIP5.highway.telekom.at [195.3.96.90]) by postgresql.org (Postfix) with SMTP id 6EF39475458 for ; Thu, 17 Apr 2003 12:02:13 -0400 (EDT) Received: (qmail 455422 invoked from network); 17 Apr 2003 16:02:13 -0000 Received: from m156p017.dipool.highway.telekom.at (HELO cantor) ([62.46.9.113]) (envelope-sender ) by qmail4rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 17 Apr 2003 16:02:13 -0000 From: Manfred Koizar To: Rajesh Kumar Mallah Cc: Christoph Haller , pgsql-sql@postgresql.org Subject: Re: getting rid of "Adding missing FROM-clause entry...." Date: Thu, 17 Apr 2003 18:02:12 +0200 Message-ID: <6ijt9vgiapkddv4o7cvj9rjprbmdkkcd8b@4ax.com> References: <3E9EB59F.B01FBF60@rodos.fzk.de> <200304172021.28073.mallah@trade-india.com> <200304172122.17761.mallah@trade-india.com> In-Reply-To: <200304172122.17761.mallah@trade-india.com> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-32.2 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_FORTE autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/280 X-Sequence-Number: 12981 On Thu, 17 Apr 2003 21:22:17 +0530, Rajesh Kumar Mallah 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. Servus Manfred