Re: Savepoints in PgAdmin

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: pgadmin-support(at)postgresql(dot)org
Cc: DUPREZ Cédric <cedric(dot)duprez(at)ifn(dot)fr>
Subject: Re: Savepoints in PgAdmin
Date: 2009-08-20 21:09:36
Message-ID: 200908202309.36882.guillaume@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.org
http://dalibo.com

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Andrew Maclean 2009-08-20 21:31:58 Re: sudden program termination: no warning, error, or crash
Previous Message Dave Page 2009-08-20 19:21:05 Re: sudden program termination: no warning, error, or crash