Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ee7uY-0001IU-Cj for pgsql-bugs@arkaria.postgresql.org; Tue, 23 Jan 2018 23:23:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ee7uX-0007Gn-Vc for pgsql-bugs@arkaria.postgresql.org; Tue, 23 Jan 2018 23:23:25 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ee7uX-0007Gd-Mi for pgsql-bugs@lists.postgresql.org; Tue, 23 Jan 2018 23:23:25 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ee7uS-0001WF-LK for pgsql-bugs@postgresql.org; Tue, 23 Jan 2018 23:23:24 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1ee7uR-0001ph-3G; Tue, 23 Jan 2018 18:23:19 -0500 Date: Tue, 23 Jan 2018 18:23:19 -0500 From: Bruce Momjian To: "David G. Johnston" Cc: mhwood@ameritech.net, "pgsql-bugs@postgresql.org" Subject: Re: BUG #14912: Undocumented: 'psql -l' assumes database 'postgresql' not $USER Message-ID: <20180123232319.GA26207@momjian.us> References: <20171116171735.1474.30450@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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, 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 >         >         >        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 postgres database, not the user's, > +      will be targeted for connection. This is similar to the meta-command >        \list. >         >         > > > 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 > > > 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 postgres database, not the user's, > + will be targeted for connection. This is similar to the meta-command > \list. > > -- Bruce Momjian 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 +