Re: Savepoints in PgAdmin
От | Guillaume Lelarge |
---|---|
Тема | Re: Savepoints in PgAdmin |
Дата | |
Msg-id | 200908202309.36882.guillaume@lelarge.info обсуждение исходный текст |
Ответ на | Savepoints in PgAdmin (DUPREZ Cédric <cedric.duprez@ifn.fr>) |
Ответы |
Re: Savepoints in PgAdmin
|
Список | 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 по дате отправления: