Thread: [HACKERS] Defaulting psql to ON_ERROR_ROLLBACK=interactive

[HACKERS] Defaulting psql to ON_ERROR_ROLLBACK=interactive

From
Peter van Hardenberg
Date:
All,

Ads and I were talking over breakfast about usability issues and he mentioned transaction cancellation during interactive sessions as a serious pain point.

I suggest we update the default of ON_ERROR_ROLLBACK to interactive for 10.0. 

The last discussion I could find about this subject was in 2011 and while there was concern about setting the default to "on" (as this would tamper with the expected behaviour of scripts), I don't see any identification of a problem that would be caused by setting it to "interactive" by default.


It's quite clear to me that the current default behaviour costs the world serious pain and heart-ache on a daily basis. I myself have made this mistake in the middle of a long transaction (as my former colleague Will describes in the previous thread) and I can only imagine others have as well.

A few preemptive rejoinders to the obvious objections:

- We shouldn't optimize for people who make mistakes.

It may well be that you don't make mistakes, but I do, and I expect I am hardly the less competent person using Postgres, so we should design our system accordingly.

- Anyone who wants this can set it in their .psqlrc already.

Most people won't know about .psqlrc, and even fewer will set it. Worse, by the time you realize you don't have it set, it will be too late to do anything about.

If folks are comfortable with this change, I'll provide a patch for the current commitfest.

--
Peter van Hardenberg
San Francisco, California
"Everything was beautiful, and nothing hurt."—Kurt Vonnegut

Re: [HACKERS] Defaulting psql to ON_ERROR_ROLLBACK=interactive

From
"Tsunakawa, Takayuki"
Date:
From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Peter van
> Hardenberg
> I suggest we update the default of ON_ERROR_ROLLBACK to interactive for
> 10.0.

+1

Regards
Takayuki Tsunakawa


Re: [HACKERS] Defaulting psql to ON_ERROR_ROLLBACK=interactive

From
Tom Lane
Date:
Peter van Hardenberg <pvh@pvh.ca> writes:
> It's quite clear to me that the current default behaviour costs the world
> serious pain and heart-ache on a daily basis.

This is a large claim for which you've provided little evidence.  On the
other hand, changing behavior like this from one version to the next will
definitely cause a lot of pain and heartache.

I'm also dubious that ON_ERROR_ROLLBACK=interactive is a completely
problem-free setting.  It will at least mean that copying-and-pasting
between a script file and your terminal doesn't work transparently.
        regards, tom lane



Re: [HACKERS] Defaulting psql to ON_ERROR_ROLLBACK=interactive

From
Robert Haas
Date:
On Wed, Mar 15, 2017 at 2:29 AM, Peter van Hardenberg <pvh@pvh.ca> wrote:
> Ads and I were talking over breakfast about usability issues and he
> mentioned transaction cancellation during interactive sessions as a serious
> pain point.
>
> I suggest we update the default of ON_ERROR_ROLLBACK to interactive for
> 10.0.
>
> The last discussion I could find about this subject was in 2011 and while
> there was concern about setting the default to "on" (as this would tamper
> with the expected behaviour of scripts), I don't see any identification of a
> problem that would be caused by setting it to "interactive" by default.

Well, then you'd get one behavior when you use psql interactively, and
another behavior when you use it from a script.  And if you used a
client other than psql the behavior would be different from psql.
Plus, it's kinda surprising to have a client that, by default, is
sending secret commands to the server that you don't know about.  And
it's a backward-incompatible change against previous releases.  I
don't think any of that makes this the worst idea ever, but on balance
I still think it's better to just recommend to people that they
configure their .psqlrc with this setting if they want the behavior.

In short, -1 from me.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: [HACKERS] Defaulting psql to ON_ERROR_ROLLBACK=interactive

From
Pavel Stehule
Date:


2017-03-15 16:38 GMT+01:00 Robert Haas <robertmhaas@gmail.com>:
On Wed, Mar 15, 2017 at 2:29 AM, Peter van Hardenberg <pvh@pvh.ca> wrote:
> Ads and I were talking over breakfast about usability issues and he
> mentioned transaction cancellation during interactive sessions as a serious
> pain point.
>
> I suggest we update the default of ON_ERROR_ROLLBACK to interactive for
> 10.0.
>
> The last discussion I could find about this subject was in 2011 and while
> there was concern about setting the default to "on" (as this would tamper
> with the expected behaviour of scripts), I don't see any identification of a
> problem that would be caused by setting it to "interactive" by default.

Well, then you'd get one behavior when you use psql interactively, and
another behavior when you use it from a script.  And if you used a
client other than psql the behavior would be different from psql.
Plus, it's kinda surprising to have a client that, by default, is
sending secret commands to the server that you don't know about.  And
it's a backward-incompatible change against previous releases.  I
don't think any of that makes this the worst idea ever, but on balance
I still think it's better to just recommend to people that they
configure their .psqlrc with this setting if they want the behavior.

In short, -1 from me.

I agree with Robert. I prefer some doc, web page "after install steps". 

Pavel
 

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Defaulting psql to ON_ERROR_ROLLBACK=interactive

From
Joshua Yanovski
Date:
Just chiming in: I rely heavily on the current default behavior
because it prevents large statements pasted into psql that cause
errors in transactions from partially running, and if it were changed
I would have caused production outages.

On Wed, Mar 15, 2017 at 8:42 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>
>
> 2017-03-15 16:38 GMT+01:00 Robert Haas <robertmhaas@gmail.com>:
>>
>> On Wed, Mar 15, 2017 at 2:29 AM, Peter van Hardenberg <pvh@pvh.ca> wrote:
>> > Ads and I were talking over breakfast about usability issues and he
>> > mentioned transaction cancellation during interactive sessions as a
>> > serious
>> > pain point.
>> >
>> > I suggest we update the default of ON_ERROR_ROLLBACK to interactive for
>> > 10.0.
>> >
>> > The last discussion I could find about this subject was in 2011 and
>> > while
>> > there was concern about setting the default to "on" (as this would
>> > tamper
>> > with the expected behaviour of scripts), I don't see any identification
>> > of a
>> > problem that would be caused by setting it to "interactive" by default.
>>
>> Well, then you'd get one behavior when you use psql interactively, and
>> another behavior when you use it from a script.  And if you used a
>> client other than psql the behavior would be different from psql.
>> Plus, it's kinda surprising to have a client that, by default, is
>> sending secret commands to the server that you don't know about.  And
>> it's a backward-incompatible change against previous releases.  I
>> don't think any of that makes this the worst idea ever, but on balance
>> I still think it's better to just recommend to people that they
>> configure their .psqlrc with this setting if they want the behavior.
>>
>> In short, -1 from me.
>
>
> I agree with Robert. I prefer some doc, web page "after install steps".
>
> Pavel
>
>>
>>
>> --
>> Robert Haas
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>
>> --
>> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-hackers
>
>



Re: [HACKERS] Defaulting psql to ON_ERROR_ROLLBACK=interactive

From
Andreas 'ads' Scherbaum
Date:
On 15.03.2017 16:38, Robert Haas wrote:
> On Wed, Mar 15, 2017 at 2:29 AM, Peter van Hardenberg <pvh@pvh.ca> wrote:
>> Ads and I were talking over breakfast about usability issues and he
>> mentioned transaction cancellation during interactive sessions as a serious
>> pain point.
>>
>> I suggest we update the default of ON_ERROR_ROLLBACK to interactive for
>> 10.0.
>>
>> The last discussion I could find about this subject was in 2011 and while
>> there was concern about setting the default to "on" (as this would tamper
>> with the expected behaviour of scripts), I don't see any identification of a
>> problem that would be caused by setting it to "interactive" by default.
> Well, then you'd get one behavior when you use psql interactively, and
> another behavior when you use it from a script.  And if you used a
> client other than psql the behavior would be different from psql.
> Plus, it's kinda surprising to have a client that, by default, is
> sending secret commands to the server that you don't know about.  And
> it's a backward-incompatible change against previous releases.  I
> don't think any of that makes this the worst idea ever, but on balance
> I still think it's better to just recommend to people that they
> configure their .psqlrc with this setting if they want the behavior.

I'm not entirely convinced that psql should behave the same way no 
matter how it is started.
Usually I put a \set ON_ERROR_STOP on the top of my scripts - something 
I never do in interactive mode, just too lazy for that. Behaviour is 
just different if I use psql in script mode.
Also if you paste something, you are still using it interactive - you 
could as well just \i the script file.

However I agree that should be something which is announced, and maybe 
changed a release later.

After further discussion, Peter will propose another solution soon.

--             Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project