BUG #14658: psql set autocommit in command line

Started by Stefan Lindneralmost 9 years ago3 messagesbugs
Jump to latest
#1Stefan Lindner
lindner@visionet.de

The following bug has been logged on the website:

Bug reference: 14658
Logged by: Stefan Lindner
Email address: lindner@visionet.de
PostgreSQL version: 9.6.3
Operating system: CentOS 7.2
Description:

We have set AUTOCOMMIT to off in our global psqlrc file.

If I do the following, I can set it to on:

psql

# \set AUTOCOMMIT on
# \echo :AUTOCOMMIT
on

Now I start psql with command line parameters

psql --set AUTOCOMMIT on

# \echo :AUTOCOMMIT
off

I expected that the command line --set overrides the global setting in
psqlrc file.

Am I wrong?

And how can I set AUTOCOMMIT to ON per command line if I was wrong?

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Stefan Lindner (#1)
Re: BUG #14658: psql set autocommit in command line

lindner@visionet.de writes:

I expected that the command line --set overrides the global setting in
psqlrc file.
Am I wrong?

Yes. The command line switches are processed first, then the rc file.
Since the rc file might contain arbitrary commands, it really can't
be processed until psql is fully "open for business", that is has
completed all setup tasks.

And how can I set AUTOCOMMIT to ON per command line if I was wrong?

A brute-force way is --no-psqlrc.

regards, tom lane

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

#3Stefan Lindner
stefan.lindner@visionet.de
In reply to: Tom Lane (#2)
Re: BUG #14658: psql set autocommit in command line

Thank you for your fast reply.

I did not notice "--no-psqlrc"

Kind regards

-----Ursprüngliche Nachricht-----
Von: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Gesendet: Donnerstag, 18. Mai 2017 15:41
An: Stefan Lindner
Cc: pgsql-bugs@postgresql.org
Betreff: Re: [BUGS] BUG #14658: psql set autocommit in command line

lindner@visionet.de writes:

I expected that the command line --set overrides the global setting in
psqlrc file.
Am I wrong?

Yes. The command line switches are processed first, then the rc file.
Since the rc file might contain arbitrary commands, it really can't be processed until psql is fully "open for business", that is has completed all setup tasks.

And how can I set AUTOCOMMIT to ON per command line if I was wrong?

A brute-force way is --no-psqlrc.

regards, tom lane

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