psqlrc overrides command line flags in PG 9.6
In PG 9.6 -c doesn't imply -X anymore, that's fine (well, not really,
but let's say it is).
However it seems it is no more possible to *override* what's in the
psqlrc unless the config file is disabled altogether. E.g. alignment
has a default and a different alternative can be set on command line:
$ rm ~/.psqlrc
$ psql -c "select E'1\n2' as foo"
foo
-----
1 +
2
(1 row)
$ psql -A -c "select E'1\n2' as foo"
foo
1
2
(1 row)
$ psql --pset format=unaligned -c "select E'1\n2' as foo"
foo
1
2
(1 row)
If something is specified in the psqlrc, it overrides the command line too:
$ echo '\pset format wrapped' > ~/.psqlrc
$ psql -A -c "select E'1\n2' as foo"
Output format is wrapped.
foo
-----
1 +
2
(1 row)
$ psql --pset format=unaligned -c "select E'1\n2' as foo"
Output format is wrapped.
foo
-----
1 +
2
(1 row)
The only way to have the command line working is to disable psqlrc
$ psql -AX -c "select E'1\n2' as foo"
foo
1
2
(1 row)
The command line is more specific than the configuration file: I think
it should override what defined there.
-- Daniele
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Daniele Varrazzo <daniele.varrazzo@gmail.com> writes:
In PG 9.6 -c doesn't imply -X anymore, that's fine (well, not really,
but let's say it is).
However it seems it is no more possible to *override* what's in the
psqlrc unless the config file is disabled altogether.
It was never possible to do that; the behavior has always been to
process the command line switches and then to run ~/.psqlrc.
Changing that would probably break at least as many things as it
fixes, not to mention being a complete mess implementation-wise.
You might be able to achieve the effect you're looking for with
a shell alias instead of ~/.psqlrc:
alias psql='psql --pset format=wrapped'
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