From: Bruce Momjian <bruce@momjian.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: mhwood@ameritech.net, "pgsql-bugs@postgresql.org" <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14912: Undocumented: 'psql -l' assumes database 'postgresql' not $USER
Date: Tue, 23 Jan 2018 18:23:19 -0500
Message-ID: <20180123232319.GA26207@momjian.us> (raw)
In-Reply-To: <CAKFQuwZYLRkGH2wisFk74rSRnOt4qwM+LW8C3t+uZSr+thuTmw@mail.gmail.com>
References: <20171116171735.1474.30450@wrigleys.postgresql.org>
<CAKFQuwZYLRkGH2wisFk74rSRnOt4qwM+LW8C3t+uZSr+thuTmw@mail.gmail.com>
Patch applied and backpatched through PG 10. Thanks.
---------------------------------------------------------------------------
On Thu, Nov 16, 2017 at 02:27:06PM -0700, David G. Johnston wrote:
> On Thu, Nov 16, 2017 at 10:17 AM, <mhwood@ameritech.net> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference: 14912
> Logged by: Mark Wood
> [...]
>
> That is true *unless* using -l / --list. The code shows that this option
> defaults to 'postgresql' instead, overriding the libpq defaulting.
>
>
> It actually defaults to "postgres"
>
> [...]
>
>
> The actual behavior may be reasonable, but if so it should be documented as
> an exception for the --list function.
>
>
> I can see an argument for either default, but given that this invocation has
> never defaulted to the user's database I cannot see changing it.
>
> I agree this should be considered a doc bug and back-patched. Possible
> verbiage for master below and attached.
>
> Changing the "Usage" section to point out this exception to the rule seems
> undesirable.
>
> David J.
>
> diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
> index e520cdf3ba..ad2a505b1e 100644
> --- a/doc/src/sgml/ref/psql-ref.sgml
> +++ b/doc/src/sgml/ref/psql-ref.sgml
> @@ -283,7 +283,9 @@ EOF
> <listitem>
> <para>
> List all available databases, then exit. Other non-connection
> - options are ignored. This is similar to the meta-command
> + options are ignored. If an explicit database name is not
> + found the <literal>postgres</literal> database, not the user's,
> + will be targeted for connection. This is similar to the meta-command
> <command>\list</command>.
> </para>
> </listitem>
>
>
> diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
> index e520cdf3ba..ad2a505b1e 100644
> --- a/doc/src/sgml/ref/psql-ref.sgml
> +++ b/doc/src/sgml/ref/psql-ref.sgml
> @@ -283,7 +283,9 @@ EOF
> <listitem>
> <para>
> List all available databases, then exit. Other non-connection
> - options are ignored. This is similar to the meta-command
> + options are ignored. If an explicit database name is not
> + found the <literal>postgres</literal> database, not the user's,
> + will be targeted for connection. This is similar to the meta-command
> <command>\list</command>.
> </para>
> </listitem>
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: bruce@momjian.us, david.g.johnston@gmail.com
Subject: Re: BUG #14912: Undocumented: 'psql -l' assumes database 'postgresql' not $USER
In-Reply-To: <20180123232319.GA26207@momjian.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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