On Sat, Jul 9, 2022, 08:16 Bruce Momjian <bruce@momjian.us> wrote:
On Sat, Jul 9, 2022 at 08:06:21AM -0700, David G. Johnston wrote: > Maybe invoke the wording from the libpq docs and say: > > The default database name is the same as the user connection parameter. > > https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS > > That page doesn’t feel the need to qualify user name and I don’t think it hurts > comprehension; and the writing “user parameter” there, instead of “user name”, > since the parameter is simply “user”, not “username”.
Well, it could be the login OS name if the user connection parameter is unspecified, right?
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.