Re: a trigger question - Mailing list pgsql-general

From Manfred Koizar
Subject Re: a trigger question
Date
Msg-id l5hsfu8ektu9eg6o53upamvcsggc8eegbk@4ax.com
Whole thread Raw
In response to a trigger question  ("Zhou, Lixin" <LZhou@illumina.com>)
List pgsql-general
On Tue, 4 Jun 2002 13:21:36 -0700 , "Zhou, Lixin" <LZhou@illumina.com>
wrote:
>I like to create a trigger on table A.  When a new row is inserted into A
>(ex: with i = 5), I like to have the trigger inserts a new row in table B
>whose field "i" has the same value as that of the A's (ex: i = 5).
>
>As I do this, the error message is something like: "referential integration
>violation - key referenced in B not found in A".  This makes sense to me
>since at the time the trigger inserts in B, A's new row is not visible yet
>-- not committed yet.
Lixin,

your trigger should fire AFTER INSERT instead of BEFORE INSERT.

HTH.
Servus
 Manfred

pgsql-general by date:

Previous
From: Manfred Koizar
Date:
Subject: Re: Aliias names in select criteria
Next
From: Manfred Koizar
Date:
Subject: Re: need magic formula for euro conversion