Re: Question on trigger data visibility - Mailing list pgsql-general

From Tom Lane
Subject Re: Question on trigger data visibility
Date
Msg-id 8485.1283184518@sss.pgh.pa.us
Whole thread Raw
In response to Re: Question on trigger data visibility  (Terry Lee Tucker <terry@chosen-ones.org>)
List pgsql-general
Terry Lee Tucker <terry@chosen-ones.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

pgsql-general by date:

Previous
From: wei725@lycos.com
Date:
Subject: Re: How to convert a binary filed to an integer field?
Next
From: Alvaro Herrera
Date:
Subject: Re: Database corruption