X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1C306474E44 for ; Wed, 9 Apr 2003 11:12:45 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 4EFCD474E42 for ; Wed, 9 Apr 2003 11:12:44 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h39FCm2L007046; Wed, 9 Apr 2003 11:12:49 -0400 (EDT) To: Rajesh Kumar Mallah Cc: pgsql-sql@postgresql.org Subject: Re: question about visibilty while updating multiple rows . In-reply-to: <200304091247.59378.mallah@trade-india.com> References: <200304091247.59378.mallah@trade-india.com> Comments: In-reply-to Rajesh Kumar Mallah message dated "Wed, 09 Apr 2003 12:47:59 +0530" Date: Wed, 09 Apr 2003 11:12:48 -0400 Message-ID: <7045.1049901168@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-25.8 required=5.0 tests=BAYES_00,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES 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/134 X-Sequence-Number: 12835 > If an update statement is affecting multiple rows of a table X , > Does a subselect (selecting from X only) inside EXISTS part of outer query > able to see the changes when rows are being updated one by one by outer query? No, because it's part of the same query. I believe though that a user-defined function called from the update query would see the changes made so far. So possibly you can fix your problem by pushing the EXISTS down into a SQL or plpgsql function. regards, tom lane