Re: Seeking the correct term of art for the (unique) role that is usually called "postgres"—and the mental model that underlies it all - Mailing list pgsql-general

From Jeremy Smith
Subject Re: Seeking the correct term of art for the (unique) role that is usually called "postgres"—and the mental model that underlies it all
Date
Msg-id CAM8SmLX7p7hzBfaHWC8gRvhsTxb6efkoXA-=avEsCzegaZUdvw@mail.gmail.com
Whole thread Raw
In response to Re: Seeking the correct term of art for the (unique) role that is usually called "postgres"—and the mental model that underlies it all  (Bryn Llewellyn <bryn@yugabyte.com>)
Responses Re: Seeking the correct term of art for the (unique) role that is usually called "postgres"—and the mental model that underlies it all
List pgsql-general


I can now characterize what I'd observed more clearly, thus: only a bootstrap super user (as defined above) can start a session without mentioning the name of the database to which to connect and the name of the within-cluster role to connect as—and without supplying a password. And it can do this only from as O/S session where the effective O/S user is the bootstrap superuser.


I don't believe this is correct.  psql is using libpq.  A hint to that is given in the section under the \c command:

When the command neither specifies nor reuses a particular parameter, the libpq default is used.

The libpq docs show more info on the connection parameters (https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS)

If not specified, both the user and the dbname default to the name of your operating system user.  So, this could work if your operating system user, the database name, and the database username are all postgres, but they could also all be bob.

As to the password requirement - this depends on the settings in pg_hba.conf.  You could set all connections to trust and then no one would need a password, but I wouldn't recommend that.

  -Jeremy
 
 

pgsql-general by date:

Previous
From: Bryn Llewellyn
Date:
Subject: Re: Seeking the correct term of art for the (unique) role that is usually called "postgres"—and the mental model that underlies it all
Next
From: "David G. Johnston"
Date:
Subject: Re: Seeking the correct term of art for the (unique) role that is usually called "postgres"—and the mental model that underlies it all