From: | daveg <daveg(at)sonic(dot)net> |
---|---|
To: | Hannu Krosing <hannu(at)krosing(dot)net> |
Cc: | ning <mailxiening(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: "BEGIN TRANSACTION" and "START TRANSACTION": different error handling |
Date: | 2009-09-24 12:09:16 |
Message-ID: | 20090924120916.GG27227@sonic.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)sonic(dot)net 510 536 1443 510 282 0869
If simplicity worked, the world would be overrun with insects.
From | Date | Subject | |
---|---|---|---|
Next Message | Petr Jelinek | 2009-09-24 13:10:10 | Re: [PATCH] DefaultACLs |
Previous Message | Jan Urbański | 2009-09-24 11:57:50 | Re: [PATCH] DefaultACLs |