Re: Making AFTER triggers act properly in PL functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Making AFTER triggers act properly in PL functions
Date: 2004-09-10 16:04:51
Message-ID: 19842.1094832291@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> On Wed, 8 Sep 2004, Tom Lane wrote:
>> It wouldn't quite work to use just transaction ID as the marker, since
>> the inner SET CONSTRAINTS is very possibly done without using a
>> subtransaction. But command ID or query nesting level or some such
>> would work. I think the main concern here would be the space cost of
>> adding still another field to the trigger records ... is it worth it?

> Would it be possible to basically alias the space for dte_done_xid to hold
> either the xid if it's done or the <whatever> if it's in progress? That's
> ugly, but it would presumably not increase the size of the record.

I found a way to do this, which actually is to forget the done_xid field
altogether and just store the "firing ID" number. Since firing ID
increases monotonically throughout a transaction, all triggers fired
during a given subtransaction will have IDs >= the subtransaction-start-
time ID counter. So we can clean up by looking for that, which is much
faster than the TransactionId testing anyway.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-09-10 16:13:58 Re: APR 1.0 released
Previous Message Peter Eisentraut 2004-09-10 16:03:15 Re: APR 1.0 released