pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedpsqlrc overrides command line flags in PG 9.6
2+ messages / 2 participants
[nested] [flat]
* psqlrc overrides command line flags in PG 9.6
@ 2017-03-29 14:28 Daniele Varrazzo <daniele.varrazzo@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Daniele Varrazzo @ 2017-03-29 14:28 UTC (permalink / raw)
To: pgsql-bugs
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: psqlrc overrides command line flags in PG 9.6
@ 2017-03-29 14:35 Tom Lane <tgl@sss.pgh.pa.us>
parent: Daniele Varrazzo <daniele.varrazzo@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2017-03-29 14:35 UTC (permalink / raw)
To: Daniele Varrazzo <daniele.varrazzo@gmail.com>; +Cc: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2017-03-29 14:35 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-03-29 14:28 psqlrc overrides command line flags in PG 9.6 Daniele Varrazzo <daniele.varrazzo@gmail.com>
2017-03-29 14:35 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox