aborted transaction -> error

Started by Neil Conwayalmost 24 years ago4 messagespatches
Jump to latest
#1Neil Conway
neilc@samurai.com

This patch changes the behavior of PostgreSQL so that if any queries are
executed in an implicitely aborted transaction (e.g. after an occur
occurs), we return an error (and not just a warning). For example:

nconway=# begin;
BEGIN
nconway=# insert; -- syntax error
ERROR: parser: parse error at or near ";"
nconway=# select * from a;
ERROR: current transaction is aborted, queries ignored until end of
transaction block

The old behavior was:

nconway=# begin;
BEGIN
nconway=# insert;
ERROR: parser: parse error at or near ";"
nconway=# select * from a;
WARNING: current transaction is aborted, queries ignored until end
of transaction block
*ABORT STATE*

Which can be confusing: if the client isn't paying careful attention,
they will conclude that the query has executed (because no error is
returned).

Tom remarked that our old behavior was problematic:

http://archives.postgresql.org/pgsql-hackers/2002-06/msg00325.php

Cheers,

Neil

--
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC

Attachments:

abort-error.patchtext/plain; charset=us-asciiDownload+14-31
#2Neil Conway
neilc@samurai.com
In reply to: Neil Conway (#1)
Re: aborted transaction -> error

nconway@klamath.dyndns.org (Neil Conway) writes:

This patch changes the behavior of PostgreSQL so that if any queries are
executed in an implicitely aborted transaction (e.g. after an occur
occurs), we return an error (and not just a warning).

AFAIK, this patch hasn't been applied. If there are any problems with
it, let me know.

Cheers,

Neil

--
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC

#3Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Neil Conway (#2)
Re: aborted transaction -> error

nconway@klamath.dyndns.org (Neil Conway) writes:

This patch changes the behavior of PostgreSQL so that if any queries are
executed in an implicitely aborted transaction (e.g. after an occur
occurs), we return an error (and not just a warning).

AFAIK, this patch hasn't been applied. If there are any problems with
it, let me know.

Please for the love of god apply this patch! I've just been burnt by that
darned NOTICE not being picked up as a proper error...

Chris

#4Bruce Momjian
bruce@momjian.us
In reply to: Christopher Kings-Lynne (#3)
Re: aborted transaction -> error

Applied. Sorry. I see it was posted July 29. I know I saw it, but I
can't find it in my mailbox nor in the patch queue. Not sure how I lost
it.

---------------------------------------------------------------------------

Christopher Kings-Lynne wrote:

nconway@klamath.dyndns.org (Neil Conway) writes:

This patch changes the behavior of PostgreSQL so that if any queries are
executed in an implicitely aborted transaction (e.g. after an occur
occurs), we return an error (and not just a warning).

AFAIK, this patch hasn't been applied. If there are any problems with
it, let me know.

Please for the love of god apply this patch! I've just been burnt by that
darned NOTICE not being picked up as a proper error...

Chris

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026