Re: How to crash postgres using savepoints

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joseph Shraibman <jks(at)selectacast(dot)net>, pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: How to crash postgres using savepoints
Date: 2006-11-16 20:59:33
Message-ID: 20061116205933.GO19298@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-11-16 21:08:02 Re: How to crash postgres using savepoints
Previous Message Joseph Shraibman 2006-11-16 20:59:17 Re: How to crash postgres using savepoints

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-11-16 21:01:58 Re: [HACKERS] Not your father's question about deadlocks
Previous Message Joseph Shraibman 2006-11-16 20:59:17 Re: How to crash postgres using savepoints