Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiTXx-00083C-Lf for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Jun 2020 01:59:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jiTXv-0000X2-HI for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Jun 2020 01:59:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiTXv-0000Wv-BH for pgsql-bugs@lists.postgresql.org; Tue, 09 Jun 2020 01:59:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiTXs-0008MN-Su for pgsql-bugs@lists.postgresql.org; Tue, 09 Jun 2020 01:59:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0591xIl82142412; Mon, 8 Jun 2020 21:59:18 -0400 From: Tom Lane To: "David G. Johnston" cc: exclusion@gmail.com, PostgreSQL mailing lists Subject: Re: BUG #16486: Prompted password is ignored when password specified in connection string In-reply-to: <2110959.1591655226@sss.pgh.pa.us> References: <16486-b9c93d71c02c4907@postgresql.org> <2090524.1591652199@sss.pgh.pa.us> <2110959.1591655226@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 08 Jun 2020 18:27:06 -0400" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <2142117.1591667861.0@sss.pgh.pa.us> Date: Mon, 08 Jun 2020 21:59:18 -0400 Message-ID: <2142411.1591667958@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2142117.1591667861.1@sss.pgh.pa.us> I wrote: > "David G. Johnston" writes: >> On Mon, Jun 8, 2020 at 2:36 PM Tom Lane wrote: >>> The entire point of the -W switch is that it prompts whether or not >>> the password is going to be used for anything. >> A more intuitive interpretation of -W is that it prompts for a password, >> regardless of valid values being provided by other configuration, and uses >> that password exclusively to attempt to connect to the server. >> The documentation doesn't actually say which one of those two >> interpretations is correct. > Hmm ... I had thought that the docs explained -W in more or less the same > way I did above, but I see that (at least on the psql page) things are > indeed pretty vague. I'll see about improving that. Concretely, it looks like we need edits as attached for psql, and likewise for all our other programs with similar options. The thing that was really missing here IMO is the specification that a conninfo string overrides other command-line parameters. It's somewhat debatable whether a -W prompt is a "command line parameter", but it acts that way for this purpose. In any case, I'm disinclined to document that specific interaction, because it would amount to blessing a pretty damfool practice, which is to make your password visible on the program's command line. (I wonder whether section 33.1.2 ought to specifically caution against putting passwords into command-line conninfo strings.) regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="wip-password-doc.patch"; charset="us-ascii" Content-ID: <2142117.1591667861.2@sss.pgh.pa.us> Content-Description: wip-password-doc.patch Content-Transfer-Encoding: quoted-printable diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sg= ml index 42e862cf17..816406235f 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -177,6 +177,8 @@ EOF or postgres://), it is treated as a conninfo string. See for more information. + Connection parameters found in the conninfo + string will override other options such as