Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4671A476CF6 for ; Wed, 18 Dec 2002 11:47:49 -0500 (EST) Received: from sccmmhc01.mchsi.com (sccmmhc01.mchsi.com [204.127.203.183]) by postgresql.org (Postfix) with ESMTP id E77C3476814 for ; Wed, 18 Dec 2002 11:44:25 -0500 (EST) Received: from perdue.net ([12.216.72.93]) by sccmmhc01.mchsi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20021218164431.BDUV18244.sccmmhc01.mchsi.com@perdue.net>; Wed, 18 Dec 2002 16:44:31 +0000 Message-ID: <3E00A5FE.7080300@perdue.net> Date: Wed, 18 Dec 2002 10:44:46 -0600 From: Tim Perdue User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3a) Gecko/20021123 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: PostgreSQL Mailing List Subject: Re: pl/pgsql question References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/225 X-Sequence-Number: 10813 Josh Berkus wrote: > Tim, > > >>That loop apparently does not find any matching rows, which would >>have been inserted just before this row was, inside the same >>transaction. >> >>It was successfully finding those rows before, when the trigger was >>AFTER INSERT. If I manually select those rows after the query is >>committed, I am able to pull up the matching rows. > > > I think that triggers are probably not a good strategy for the kind of > calculation you're doing. I'd suggest instead a middleware module or a > "data push" function which would bundle all of the calculation logic > before calling any of the inserts. Yeah, but this is so much cooler. ;-) Essentially this would be like recursion to push back/pull forward tasks which are dependent on each other. The "UPDATE" trigger I wrote is about 5x longer. I guess I can push this back into the PHP code and do a recusive function call, but that seems less sexy. Tim