Re: Transactions in rules.. - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Transactions in rules..
Date
Msg-id Pine.LNX.4.30.0107091751220.677-100000@peter.localdomain
Whole thread Raw
In response to Transactions in rules..  ("Fabrizio Mazzoni" <fabrizio@macron.com>)
List pgsql-general
Fabrizio Mazzoni writes:

> Can i use transactions in rules??
> I was trying something like:
>
> create rule x_test as
> on insert to view1
> do instead
> (
>     begin;
>     insert into test1 values (new.a,new.b);
>     insert into test2 values (new.c,new.d);
>     commit;
> );

The statements added by the rule will automatically be executed in the
same one transaction as the original statement that fired the rule.  Your
syntax example would sort of invoke a nested transaction, which doesn't
exist.  All in all, you don't need to worry about it.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


pgsql-general by date:

Previous
From: Alex Pilosov
Date:
Subject: Re: Transactions in rules..
Next
From: Bruce Momjian
Date:
Subject: Upcoming events in July