Re: [PATCHES] Continue transactions after errors in psql - Mailing list pgsql-hackers

From Michael Paesold
Subject Re: [PATCHES] Continue transactions after errors in psql
Date
Msg-id 01ad01c549bf$6aa3ad60$0f01a8c0@zaphod
Whole thread Raw
In response to Re: [PATCHES] Continue transactions after errors in psql  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian wrote:

> 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

My vote:
1) disable it by default for all sessions

2) enable it with \set (can be set in .psqlrc), but provide a way so it only 
works with interactive commands, either always, or something like
\set ON_ERROR_ROLLBACK interactive

Best Regards,
Michael Paesold 



pgsql-hackers by date:

Previous
From: Brent Verner
Date:
Subject: [proposal] protocol extension to support loadable stream filters
Next
From: Simon Riggs
Date:
Subject: Re: [PERFORM] Bad n_distinct estimation; hacks suggested?