Re: [PATCHES] Continue transactions after errors in psql

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [PATCHES] Continue transactions after errors in psql
Date: 2005-04-25 17:28:46
Message-ID: 200504251728.j3PHSk720817@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Greg Sabino Mullane wrote:
> > The SQL-Standard itself says that errors inside transactions should only
> > rollback the last statement, if possible. So why is that not implemented in
> > PostgreSQL? What I read from past discussions here, is because it's just
> > unsave and will lead to data-garbage if you aren't very careful.
>
> That's a good point: if that is indeed what the standard says, we should
> probably see about following it. Rolling back to the last savepoint seems
> a reasonable behavior to me.

OK, so we need to make a decision. Right now I have Greg's patch that
is enabled by "\set ON_ERROR_ROLLBACK on":

test=> \set ON_ERROR_ROLLBACK on
test=> BEGIN;
BEGIN
test=> lkjasdf;
ERROR: syntax error at or near "lkjasdf" at character 1
LINE 1: lkjasdf;
^
test=> SELECT 1;
?column?
----------
1
(1 row)

test=> COMMIT;
COMMIT

The question is what to make the default:

disable it by default for all sessions (current patch)
enable it by default only for interactive sessions, like AUTOCOMMIT
enable it by default for all sessions (breaks too many apps)
add a third mode called 'ttyonly' and figure out a default

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-04-25 17:29:14 Re: Continue transactions after errors in psql
Previous Message Bruce Momjian 2005-04-25 17:19:21 Re: Continue transactions after errors in psql

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-04-25 17:29:14 Re: Continue transactions after errors in psql
Previous Message Bruce Momjian 2005-04-25 17:19:21 Re: Continue transactions after errors in psql