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