Re: a trigger question

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: "Zhou, Lixin" <LZhou(at)illumina(dot)com>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: a trigger question
Date: 2002-06-05 17:07:54
Message-ID: l5hsfu8ektu9eg6o53upamvcsggc8eegbk@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 4 Jun 2002 13:21:36 -0700 , "Zhou, Lixin" <LZhou(at)illumina(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alejandro Delu 2002-06-05 17:13:50 How do I install Postgre on Windows NT?
Previous Message Manfred Koizar 2002-06-05 17:03:44 Re: Aliias names in select criteria