Re: [HACKERS] Fun with nested transactions in PL/pgSQL

2004-07-17 Thread Alvaro Herrera
On Sat, Jul 17, 2004 at 12:20:27PM -0700, Jonathan M. Gardner wrote: > => CREATE TABLE t (i int); > > => CREATE OR REPLACE FUNCTION test() RETURNS VOID > LANGUAGE 'plpgsql' AS ' > BEGIN > INSERT INTO t VALUES (1); > EXECUTE ''BEGIN''; > DELETE FROM t; > EXECUTE ''ROLLBACK''; > RETURN; >

[HACKERS] Fun with nested transactions in PL/pgSQL

2004-07-17 Thread Jonathan M. Gardner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Check out this gem. => CREATE TABLE t (i int); => CREATE OR REPLACE FUNCTION test() RETURNS VOID LANGUAGE 'plpgsql' AS ' BEGIN INSERT INTO t VALUES (1); EXECUTE ''BEGIN''; DELETE FROM t; EXECUTE ''ROLLBACK''; RETURN; END '; => SELECT test(