Re: transactions in multiple action rules

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: transactions in multiple action rules
Date: 2004-12-21 05:28:34
Message-ID: 20041221052834.GA4677@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Dec 20, 2004 at 23:15:39 -0500,
Ron Peterson <rpeterso(at)mtholyoke(dot)edu> wrote:
> Do the multiple actions within a multiple action rule implicitly reside
> within a transaction? I notice that if I brace my multiple actions with
> BEGIN; and COMMIT;, that I get a syntax error, so I'm assuming that's
> because they are superfluous in that context... ?
>
> (I want to be sure that I can count on 'currval' returning the sequence
> value returned by the previous action's 'nextval', so that I know I am
> inserting the proper foreign key into a table after inserting a record
> into the referenced table.)

currval returns the last value given out by nextval in the same session.
So you don't need to worry about conflicts between sessions.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-12-21 06:42:07 Re: transactions in multiple action rules
Previous Message Ron Peterson 2004-12-21 04:15:39 transactions in multiple action rules