Docs for psql regarding default database name are incorrect

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Docs for psql regarding default database name are incorrect
Date: 2022-03-14 00:15:02
Message-ID: CAKFQuwYEVVOaQokU9oi5VzfGfZcu0VEP5m6aAjP-U3OG4T_BnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The documentation for psql saith:
https://www.postgresql.org/docs/devel/app-psql.html

The default user name is your operating-system user name, as is the default
database name.

The default database name is the same as the user name chosen for the
connection attempt. Thus if one does "postgres~ psql -U davidj" the
attempted database name will be davidj, not postgres even though the latter
is the operating-system user name in effect.

The documentation for -U doesn't mention this changing of the attempted
connect-to database. It is not possible to specify a user name without a
database name explicitly given for psql unless one uses -U.

Thus at minimum the above needs to read:

The default user name is your operating-system user name. The default
database name is the same as the resolved PostgreSQL user name.

Maybe change the description for -U:

"...of course)." This also changes the default database name.

The parameter dbname in libpq got the memo:
https://www.postgresql.org/docs/devel/libpq-connect.html#LIBPQ-CONNECT-USER

The database name. Defaults to be the same as the user name.

David J.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Noah Misch 2022-03-14 07:08:07 Re: Reconnect a single connection used by multiple threads in embedded SQL in C application causes error.
Previous Message PG Bug reporting form 2022-03-13 18:10:19 BUG #17437: time spent in JIT is also attributed to function scan