psql --help=variables lists variables that can't be set

Started by Peter Eisentrautabout 10 years ago3 messages
#1Peter Eisentraut
peter_e@gmx.net

psql --help=variables shows variables treated specially by psql. And it
tells you

Usage:
psql --set=NAME=VALUE
or \set NAME VALUE

But some of the variables listed cannot usefully be set, only read, such as

DBNAME the currently connected database name
HOST the currently connected database server
LASTOID the value of last affected OID

These can be read in a script, but there is nothing useful you can do
with them on the command line.

Also, for variables such as HISTCONTROL, IGNOREEOF, PROMPT*, they are
more commonly set in psqlrc, not on the command line.

Should we trim this list down to variables that are actually useful to
set on the command line?

I also have some concerns about the listed environment variables. The
list of libpq PG* variables is incomplete, and if we're going to curate
the list, we surely don't need to show the "not recommended" PGPASSWORD
variable.

That list probably also needs some ifdefs, since SHELL and TMPDIR don't
work on Windows, and PSQL_HISTORY only works when readline support is built.

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

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: Peter Eisentraut (#1)
Re: psql --help=variables lists variables that can't be set

2015-12-04 4:08 GMT+01:00 Peter Eisentraut <peter_e@gmx.net>:

psql --help=variables shows variables treated specially by psql. And it
tells you

Usage:
psql --set=NAME=VALUE
or \set NAME VALUE

But some of the variables listed cannot usefully be set, only read, such as

DBNAME the currently connected database name
HOST the currently connected database server
LASTOID the value of last affected OID

These can be read in a script, but there is nothing useful you can do
with them on the command line.

Also, for variables such as HISTCONTROL, IGNOREEOF, PROMPT*, they are
more commonly set in psqlrc, not on the command line.

Should we trim this list down to variables that are actually useful to
set on the command line?

we can reduce this list if we use command line help. For interactive help
\h variables it should to show all.

Regards

Pavel

I also have some concerns about the listed environment variables. The
list of libpq PG* variables is incomplete, and if we're going to curate
the list, we surely don't need to show the "not recommended" PGPASSWORD
variable.

+1

That list probably also needs some ifdefs, since SHELL and TMPDIR don't
work on Windows, and PSQL_HISTORY only works when readline support is
built.

+1

Show quoted text

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

#3Andres Freund
andres@anarazel.de
In reply to: Peter Eisentraut (#1)
Re: psql --help=variables lists variables that can't be set

On 2015-12-03 22:08:31 -0500, Peter Eisentraut wrote:

psql --help=variables shows variables treated specially by psql. And it
tells you

Usage:
psql --set=NAME=VALUE
or \set NAME VALUE

But some of the variables listed cannot usefully be set, only read, such as

DBNAME the currently connected database name
HOST the currently connected database server
LASTOID the value of last affected OID

These can be read in a script, but there is nothing useful you can do
with them on the command line.

Well, you can display them, which actually isn't uninteresting (-c
'\echo :DBNAME'), and at least LASTOID is rather interesting for
scripting purposes.

Also, for variables such as HISTCONTROL, IGNOREEOF, PROMPT*, they are
more commonly set in psqlrc, not on the command line.

Should we trim this list down to variables that are actually useful to
set on the command line?

I think the increased discoverability isn't a bad thing, so I'm inclined
to not do that.

I also have some concerns about the listed environment variables. The
list of libpq PG* variables is incomplete, and if we're going to curate
the list, we surely don't need to show the "not recommended" PGPASSWORD
variable.

That list probably also needs some ifdefs, since SHELL and TMPDIR don't
work on Windows, and PSQL_HISTORY only works when readline support is built.

I don't have much an opinion about those. I think it's not too bad to
show them regardless, nor is it bad to hide them.

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