Re: "BEGIN TRANSACTION" and "START TRANSACTION": different error handling
От | daveg |
---|---|
Тема | Re: "BEGIN TRANSACTION" and "START TRANSACTION": different error handling |
Дата | |
Msg-id | 20090924120916.GG27227@sonic.net обсуждение исходный текст |
Ответ на | Re: "BEGIN TRANSACTION" and "START TRANSACTION": different error handling (Hannu Krosing <hannu@krosing.net>) |
Список | pgsql-hackers |
On Thu, Sep 24, 2009 at 12:16:43PM +0300, Hannu Krosing wrote: > "I expect the transaction is aborted and rollback is executed > automatically." - this is not how postgreSQL behaves. PostgreSQL needs > an explicit end of transaction from client, either COMMIT; or ROLLBACK; > > when run from psql, they both act the same, except the string returned > > hannu=# begin transaction; > BEGIN > hannu=# select 1/0; > ERROR: division by zero > hannu=# select 1/0; > ERROR: current transaction is aborted, commands ignored until end of > transaction block > hannu=# abort; > ROLLBACK > hannu=# start transaction; > START TRANSACTION > hannu=# select 1/0; > ERROR: division by zero > hannu=# select 1/0; > ERROR: current transaction is aborted, commands ignored until end of > transaction block > hannu=# abort; > ROLLBACK > > I suspect, that psqlodbc is the one doing the automatic rollback and it > seems to rely on reply "BEGIN" to establish an in-transaction state. > > so when "start transaction;" returns "START TRANSACTION" instead of > "BEGIN", psqlodbc does not realise that it is in transaction and does > not initiate the automatic rollback. Well. I'd always thought BEGIN and START were syntactic Aspartame and had the same underlying implementation. So this is a surprise. Why do they return a different status? -dg ` -- David Gould daveg@sonic.net 510 536 1443 510 282 0869 If simplicity worked, the world would be overrun with insects.
В списке pgsql-hackers по дате отправления: