Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A70694762E3 for ; Fri, 18 Oct 2002 12:23:07 -0400 (EDT) Received: from crundall.nidweb.net (crundall.nidweb.net [216.229.174.197]) by postgresql.org (Postfix) with ESMTP id C62C947624C for ; Fri, 18 Oct 2002 12:23:06 -0400 (EDT) Received: from ac6rm.net (localhost [127.0.0.1]) by crundall.nidweb.net (8.9.3/8.9.3) with SMTP id JAA21865; Fri, 18 Oct 2002 09:59:10 -0700 Received: from 24.52.245.104 (SquirrelMail authenticated user martin) by webmail.ac6rm.net with HTTP; Fri, 18 Oct 2002 09:59:10 -0700 (PDT) Message-ID: <63503.24.52.245.104.1034960350.squirrel@webmail.ac6rm.net> Date: Fri, 18 Oct 2002 09:59:10 -0700 (PDT) Subject: Re: TRIGGERed INSERTS From: "Martin Crundall" To: In-Reply-To: <17482.1034950973@sss.pgh.pa.us> References: <63387.24.52.245.104.1034949598.squirrel@webmail.ac6rm.net> <17482.1034950973@sss.pgh.pa.us> X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Cc: Reply-To: pgsql@ac6rm.net X-Mailer: SquirrelMail (version 1.2.7) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/214 X-Sequence-Number: 9931 Thanks Tom. The work-around was to create the "script" in SQL -- using SELECT INTO statements to capture the key values -- instead of creating the "script" as a stored procedure. Seems like a "transaction" issue. Having transactions occur at the SELECT level is very intuitive and a really nice, "protect-us-from-ourselves" feature that I'm not sure I'd want to mess with. Having the ability to execute a stored procedure outside the scope of a SELECT would ultimately resolve this. A topic for another day ... unless I missed something in an update somewhere. Anyway, thanks again. > "Martin Crundall" writes: >> Some of the data tables have "AFTER INSERT" TRIGGERs on them that, >> in >> turn, insert some subordinate items into parallel data tables and the >> central pointer/ordering table. > > It looks to me like AFTER triggers are fired upon return to the main > loop in postgres.c, thus only at the end of a querystring sent by the > client. This is perhaps wrong, but I'm not sure that allowing them to > fire during plpgsql functions would be a good thing either. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html