Re: Trigger problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mordicus(at)free(dot)fr
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger problem
Date: 2001-12-07 15:20:55
Message-ID: 29623.1007738455@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

mordicus <mordicus(at)free(dot)fr> writes:
> Stephan Szabo wrote:
>> Wouldn't NEW.id give you the value you want rather than mucking with the
>> sequence value?

> hum, not tested but i don't think because nextval('abr_id') is the default
> value of id.

Stephan gave you the correct answer. A trigger runs after the values
that are to be inserted into the tuple have all been computed.

You might also consider whether a BEFORE trigger would make more sense
than an AFTER trigger, if you don't want the trigger execution delayed
till end-of-statement.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2001-12-07 15:24:12 Re: When do I Vacuum ?
Previous Message jeff scott 2001-12-07 15:14:20 Any comments on any of the recent crop of books?