X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4B9CC47623E for ; Fri, 28 Feb 2003 08:23:39 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 38667-09 for ; Fri, 28 Feb 2003 08:23:27 -0500 (EST) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by postgresql.org (Postfix) with SMTP id 899EC475E2C for ; Fri, 28 Feb 2003 05:08:58 -0500 (EST) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Fri Feb 28 11:08:59 2003 +0100 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id LAA12956; Fri, 28 Feb 2003 11:08:58 +0100 (MET) Message-ID: <3E5F353A.9CD80F19@rodos.fzk.de> Date: Fri, 28 Feb 2003 11:08:58 +0100 From: Christoph Haller X-Mailer: Mozilla 4.77 [en] (X11; U; HP-UX B.10.20 9000/780) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Cc: egrignon@egrignon.com Subject: Re: pgsql problem Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/614 X-Sequence-Number: 12012 > > > > > > > CREATE TRIGGER OnCreateUser > > > AFTER INSERT > > > ON users FOR EACH ROW > > > EXECUTE PROCEDURE CreateUserTrig(); > > > > > Have you thought of using BEFORE INSERT instead of AFTER INSERT? > > > Well, no, but I want to do it only after the insert because I will use the > primary key to insert it in an other table, so I have to be sure that it has > been inserted. > Could you explain to me why it doesn't work ? > Well, I think Stephan did: Right now AFAIR after triggers run at the end of the containing statement (in this case the select of createuser) which is what causes the behavior you're seeing. I'm not sure of a good work around, off hand, for your case though. So, what about just skipping the trigger and move the trigger function to CreateUser? Regards, Christoph