Re: Fun with nested transactions in PL/pgSQL - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Fun with nested transactions in PL/pgSQL
Date
Msg-id 20040717220919.GA11041@dcc.uchile.cl
Whole thread Raw
In response to Fun with nested transactions in PL/pgSQL  ("Jonathan M. Gardner" <jgardner@jonathangardner.net>)
List pgsql-hackers
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;
> END
> ';
> 
> => SELECT test();
> server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.

I described this behavior not less than two weeks ago, including why it
happens.  Try "begin; select test(); commit".

The submitted savepoint patch prevents this from happening, and some
other misbehaviors as well.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"I personally became interested in Linux while I was dating an English major
who wouldn't know an operating system if it walked up and bit him."
(Val Henson)



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Why we really need timelines *now* in PITR
Next
From: Gaetano Mendola
Date:
Subject: unused variable