From: Christoph Haller <ch@rodos.fzk.de>
To: pgsql-sql@postgresql.org
Cc: egrignon@egrignon.com
Subject: Re: pgsql problem
Date: Fri, 28 Feb 2003 11:08:58 +0100
Message-ID: <3E5F353A.9CD80F19@rodos.fzk.de> (raw)
>
> > >
> > > 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: ch@rodos.fzk.de, egrignon@egrignon.com
Subject: Re: pgsql problem
In-Reply-To: <3E5F353A.9CD80F19@rodos.fzk.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox