Re: Surprising behaviour of \set AUTOCOMMIT ON - Mailing list pgsql-hackers

From Rahila Syed
Subject Re: Surprising behaviour of \set AUTOCOMMIT ON
Date
Msg-id CAH2L28tuMnV9976Xhgh-vobuCoWqDkwdkP0zf8yY4i9jHpD-Hw@mail.gmail.com
Whole thread Raw
In response to Re: Surprising behaviour of \set AUTOCOMMIT ON  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Surprising behaviour of \set AUTOCOMMIT ON  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
<div dir="ltr"><p dir="ltr">>I think I like the option of having psql issue an error.  On the<br /> >server side,
thetransaction would still be open, but the user would<br /> >receive a psql error message and the autocommit
settingwould not be<br /> >changed.  So the user could type COMMIT or ROLLBACK manually and then<br /> >retry
changingthe value of the setting.<p dir="ltr">Throwing psql error comes out to be most accepted outcome on this thread.
Iagree it is safer than guessing user intention. <p>Although according to the default behaviour of psql, error will
abortthe current transaction and roll back all the previous commands. This can be user unfriendly making user rerun all
thecommands just because of autocommit switch. So probably behaviour of 'ON_ERROR_ROLLBACK on' needs to be implemented
alongwith the error display. This will rollback just the autocommit switch command.<p>Also, psql error instead of a
simplecommit will lead to script terminations. Hence issuing a COMMIT seems more viable here. However, script
terminationcan be avoided by default behaviour of ON_ERROR_STOP which will execute subsequent commands
successfully.(Howeversubsequent commands won't be executed in autocommit mode which I think should be OK as it will be
notifiedvia ERROR).<p>So summarizing my view of the discussion on this thread, issuing a psql error seems to be the
bestoption. I will post a patch regarding this if there is no objection. <p><br /><p>Thank you,<p>Rahila Syed<p><br
/><p><br/></div> 

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Detecting skipped data from logical slots (data silently skipped)
Next
From: Peter Geoghegan
Date:
Subject: Re: WIP: Barriers