Re: Savepoints in PgAdmin - Mailing list pgadmin-support

From Guillaume Lelarge
Subject Re: Savepoints in PgAdmin
Date
Msg-id 200908202309.36882.guillaume@lelarge.info
Whole thread Raw
In response to Savepoints in PgAdmin  (DUPREZ Cédric <cedric.duprez@ifn.fr>)
Responses Re: Savepoints in PgAdmin  (Dave Page <dpage@pgadmin.org>)
List pgadmin-support
Le jeudi 20 août 2009 à 16:16:07, DUPREZ Cédric a écrit :
> [...]
> This problem seems to come from the fact that PgAdmin executes code in a
> single transaction statement...
>

I'm sure it doesn't. Try to do the following steps:

BEGIN;
CREATE temp TABLE toto (id int);
INSERT INTO toto VALUES (1);
SAVEPOINT my_save;

Then:
INSERT INTO toto VALUES (2);

Then:
SELECT * FROM toto;

You should get two values. Then rollback to my_save:

ROLLBACK TO my_save;

And finally:

SELECT * FROM toto;

You should get only one value, which demonstrates than you can use savepoint.

>
> SAVEPOINT my_save;
> How is it possible to create different transaction statements within
> PgAdmin, in order to use savepoints ?
>

You're right on one point. If it fails, pgAdmin automatically does a ROLLBACK.
In the frmQuery::completeQuery() method, there is this code:

// If the transaction aborted for some reason, issue a rollback to cleanup.
if (conn->GetTxStatus() == PGCONN_TXSTATUS_INERROR)   conn->ExecuteVoid(wxT("ROLLBACK;"));

We should perhaps have an option to enable/disable this behaviour. Dave, what
do you think about this? should I add a ticket on this issue?

Thanks for your report.


--
Guillaume.http://www.postgresqlfr.orghttp://dalibo.com


pgadmin-support by date:

Previous
From: Dave Page
Date:
Subject: Re: sudden program termination: no warning, error, or crash
Next
From: Andrew Maclean
Date:
Subject: Re: sudden program termination: no warning, error, or crash