Re: Fun with nested transactions in PL/pgSQL

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: "Jonathan M(dot) Gardner" <jgardner(at)jonathangardner(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fun with nested transactions in PL/pgSQL
Date: 2004-07-17 22:09:19
Message-ID: 20040717220919.GA11041@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gaetano Mendola 2004-07-17 23:05:08 unused variable
Previous Message Tom Lane 2004-07-17 20:36:09 Why we really need timelines *now* in PITR