Re: How to crash postgres using savepoints - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: How to crash postgres using savepoints
Date
Msg-id 20061116205933.GO19298@alvh.no-ip.org
Whole thread Raw
In response to Re: How to crash postgres using savepoints  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: How to crash postgres using savepoints
List pgsql-bugs
Tom Lane wrote:

> Actually, I'd say the dubious behavior here is that
>
>     SAVEPOINT foo;
>     SAVEPOINT foo;
>     SAVEPOINT foo;
>
> creates three nested savepoints ... it might be better if it
> automatically released any existing savepoint of the same name.
> I notice that the SAVEPOINT reference page says the latter is
> the behavior required by the SQL spec.  Did we explicitly decide
> to do this differently from spec, and if so why?

Yeah, we did.  I think the rationale was what happens when you have
another savepoint in the middle, say

SAVEPOINT foo;
SAVEPOINT bar;
SAVEPOINT foo;

The fact that the third sentence would implicitely release the "bar"
savepoint bothered us.  IIRC Oracle gets away with this because their
savepoints are not actually nested, but sequential (i.e. you can release
"foo" without forgetting about "bar").  I'm not really sure about this.

Maybe we could change the behavior so that establishing a savepoint
releases a savepoint of the same name if it's the direct parent, but
that doesn't follow the KISS principle.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-bugs by date:

Previous
From: Joseph Shraibman
Date:
Subject: Re: How to crash postgres using savepoints
Next
From: Tom Lane
Date:
Subject: Re: How to crash postgres using savepoints