Re: Question on trigger data visibility

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Question on trigger data visibility
Date: 2010-08-30 16:08:38
Message-ID: 8485.1283184518@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Terry Lee Tucker <terry(at)chosen-ones(dot)org> writes:
> On Monday, August 30, 2010 07:20:14 Maurice Gittens wrote:
>> So, it seems that even though my trigger is defined as AFTER INSERT
>> FOR EACH STATEMENT, the inserted row
>> does not appear to be included in the join.
>>
>> So, now to my question: Should, as a matter of principle, statement
>> level triggers not "see" rows recently inserted into the tablex?

> They do "see" those rows. Are you sure that the inner join with tab_Y is not
> causing the problem? Just a guess...

It also seems worth pointing out that this trigger would hardly ensure
referential integrity. As quoted, it would succeed so long as there is
at least one tablex row that is properly referencing some tablez row.
Surely you want to require that they *all* do.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2010-08-30 16:45:41 Re: Database corruption
Previous Message wei725 2010-08-30 15:27:06 Re: How to convert a binary filed to an integer field?