Re: doc: Fix description of how the default user name is chosen - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: doc: Fix description of how the default user name is chosen
Date
Msg-id CAKFQuwaH=m08MFSQF17YZDzoBT_CW52ebDYNr8saPcWDDXkQBA@mail.gmail.com
Whole thread Raw
In response to Re: doc: Fix description of how the default user name is chosen  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: doc: Fix description of how the default user name is chosen
List pgsql-hackers
This is the only sentence I claim is factually incorrect, with a suggested re-wording.

diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 9494f28063..f375a0fc11 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -660,7 +660,8 @@ EOF
     determined at compile time.
     Since the database server uses the same default, you will not have
     to specify the port in most cases. The default user name is your
-    operating-system user name, as is the default database name.
+    operating-system user name. Once the user name is determined it is
+    used as the default database name.
     Note that you cannot
     just connect to any database under any user name. Your database
     administrator should have informed you about your access rights.

Oddly, this section is the only one where I'd want to say "database user name" but it doesn't do that.  For consistency on that point, the following chunk can be used instead (the attached diff does this):

diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 9494f28063..38d12933ca 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -646,23 +646,23 @@ EOF
     <application>psql</application> is a regular
     <productname>PostgreSQL</productname> client application. In order
     to connect to a database you need to know the name of your target
-    database, the host name and port number of the server, and what user
-    name you want to connect as. <application>psql</application> can be
-    told about those parameters via command line options, namely
+    database, the host name and port number of the server, and what
+    database user name you want to connect as. <application>psql</application>
+    can be told about those parameters via command line options, namely
     <option>-d</option>, <option>-h</option>, <option>-p</option>, and
     <option>-U</option> respectively. If an argument is found that does
     not belong to any option it will be interpreted as the database name
-    (or the user name, if the database name is already given). Not all
+    (or the database user name, if the database name is already given). Not all
     of these options are required; there are useful defaults. If you omit the host
     name, <application>psql</application> will connect via a Unix-domain socket
     to a server on the local host, or via TCP/IP to <literal>localhost</literal> on
-    Windows. The default port number is
-    determined at compile time.
+    Windows. The default port number is determined at compile time.
     Since the database server uses the same default, you will not have
-    to specify the port in most cases. The default user name is your
-    operating-system user name, as is the default database name.
+    to specify the port in most cases. The default database user name is your
+    operating-system user name. Once the database user name is determined it is
+    used as the default database name.
     Note that you cannot
-    just connect to any database under any user name. Your database
+    just connect to any database under any database user name. Your database
     administrator should have informed you about your access rights.
     </para>

And removing the unnecessary commentary in client-auth.sgml

diff --git a/doc/src/sgml/client-auth.sgml b/doc/src/sgml/client-auth.sgml
index 32d5d45863..5c6211809b 100644
--- a/doc/src/sgml/client-auth.sgml
+++ b/doc/src/sgml/client-auth.sgml
@@ -2255,7 +2255,7 @@ FATAL:  database "testdb" does not exist
 </programlisting>
     The database you are trying to connect to does not exist. Note that
     if you do not specify a database name, it defaults to the database
-    user name, which might or might not be the right thing.
+    user name.
    </para>

    <tip>

David J.




On Mon, Oct 31, 2022 at 6:41 AM Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:
On 09.07.22 17:52, David G. Johnston wrote:
> No.  It is always the user parameter.  It just so happens that parameter
> also has a default.  And so while there is a transitive aspect the
> resolution of the user parameter happens first, using the OS user if
> needed, then the dbname parameter is resolved using the user parameter
> if needed to supply the default.

Will there be an updated patch here?  The original patch contained three
hunks; I'm not sure which one of those was intending to fix a real bug
and which ones were cosmetic.  Is anything in the current documentation
actually wrong?

Attachment

pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: Pluggable toaster
Next
From: Justin Pryzby
Date:
Subject: Re: warn if GUC set to an invalid shared library