Thread: Seeming contradiction in 22.1

Seeming contradiction in 22.1

From
PG Doc comments form
Date:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/database-roles.html
Description:

In chapter 22.1 the following text seems to imply the role will have "the
same name as the user that initialised" it and also the "role will be named
postgres". Which cannot both be true, or perhaps the text is trying to say
something else, but in doing so is not clear. 

"This role is always a “superuser”, and by default (unless altered when
running initdb) it will have the same name as the operating system user that
initialized the database cluster. Customarily, this role will be named
postgres. "

Re: Seeming contradiction in 22.1

From
"David G. Johnston"
Date:
On Monday, March 20, 2023, PG Doc comments form <noreply@postgresql.org> wrote:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/database-roles.html
Description:

In chapter 22.1 the following text seems to imply the role will have "the
same name as the user that initialised" it and also the "role will be named
postgres". Which cannot both be true, or perhaps the text is trying to say
something else, but in doing so is not clear.

"This role is always a “superuser”, and by default (unless altered when
running initdb) it will have the same name as the operating system user that
initialized the database cluster. Customarily, this role will be named
postgres. "

The words “default” and “unless altered” seem quite clear to me.  In particular, the “customarily” part is accomplished usually by creating an operating system user named postgres and then running initdb as that user.

David J.

Re: Seeming contradiction in 22.1

From
maja zaloznik
Date:
Thanks for your reply David,

i think you are right about the natural way to interpret the text - although if that was the intention it could probably be worded more clearly e.g. by adding 'renamed' or 'instead' or both.

My issue is that - at least as far as i can recall - the default superuser was already named postgres, in which case that interpretation doesn't work. I apologize if I'm mistaken, I've only setup a cluster twice and an not 100% on this.

Also, i forgot to mention the first time : kudos to everyone for the insanely good documentation, it really is outstanding!

Best,
Maja 


On Wed, 22 Mar 2023, 22:48 David G. Johnston, <david.g.johnston@gmail.com> wrote:
On Monday, March 20, 2023, PG Doc comments form <noreply@postgresql.org> wrote:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/database-roles.html
Description:

In chapter 22.1 the following text seems to imply the role will have "the
same name as the user that initialised" it and also the "role will be named
postgres". Which cannot both be true, or perhaps the text is trying to say
something else, but in doing so is not clear.

"This role is always a “superuser”, and by default (unless altered when
running initdb) it will have the same name as the operating system user that
initialized the database cluster. Customarily, this role will be named
postgres. "

The words “default” and “unless altered” seem quite clear to me.  In particular, the “customarily” part is accomplished usually by creating an operating system user named postgres and then running initdb as that user.

David J.

Re: Seeming contradiction in 22.1

From
"David G. Johnston"
Date:
On Wed, Mar 22, 2023 at 3:41 PM maja zaloznik <maja.zaloznik@gmail.com> wrote:
My issue is that - at least as far as i can recall - the default superuser was already named postgres
 
There is no compiled-in default for the name of the bootstrap superuser.  It is chosen during initdb using the algorithm described (i.e., o/s user running initdb or the name specified on the CLI)

David J.

Re: Seeming contradiction in 22.1

From
maja zaloznik
Date:
Thanks David,

sorry for pushing this - I don't mean to imply what you say is not true, but would like to understand how it can be true and at the same time users like me are convinced otherwise. The internet is chock full of instructions and tutorials mentioning the default superuser is postgres, not the user's os username as far as i can tell (except for official pg documentation). Another example is the user Tim in this thread https://stackoverflow.com/questions/50883645/is-postgres-a-default-and-special-user-of-postgresql, who also seems to be convinced that they didn't name the superuser postgres.

I'm tempted to do another install on my laptop to see what happens :))

My point being that if what you say is true but runs counter to what essentially all other instructions on the internet say, it would seem prudent to mention this disparity and the reasons for it in the canonical documentation, which would be especially valuable for noobs like me.

Thanks again for your help,
Maja






On Thu, 23 Mar 2023, 00:42 David G. Johnston, <david.g.johnston@gmail.com> wrote:
On Wed, Mar 22, 2023 at 3:41 PM maja zaloznik <maja.zaloznik@gmail.com> wrote:
My issue is that - at least as far as i can recall - the default superuser was already named postgres
 
There is no compiled-in default for the name of the bootstrap superuser.  It is chosen during initdb using the algorithm described (i.e., o/s user running initdb or the name specified on the CLI)

David J.

Seeming contradiction in 22.1

From
"David G. Johnston"
Date:
On Thursday, March 23, 2023, maja zaloznik <maja.zaloznik@gmail.com> wrote:

My point being that if what you say is true but runs counter to what essentially all other instructions on the internet say, it would seem prudent to mention this disparity and the reasons for it in the canonical documentation, which would be especially valuable for noobs like me.

The root issue, IMO, is that all packagers have settled on the convention of using Postgres for the superuser name, so if one only ever sees that, it is easy to assume it is some kind of default of the software itself.  In the face of consistent evidence, people not reading the documentation is my supposed assumption for their ignorance of this point.  But reading the docs, it is clear how the system really works (I.e., the name of the bootstrap superuser comes is derived at initdb time from the environment executing initdb).

David J.
 

Re: Seeming contradiction in 22.1

From
Tom Lane
Date:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> The root issue, IMO, is that all packagers have settled on the convention
> of using Postgres for the superuser name, so if one only ever sees that, it
> is easy to assume it is some kind of default of the software itself.  In
> the face of consistent evidence, people not reading the documentation is my
> supposed assumption for their ignorance of this point.  But reading the
> docs, it is clear how the system really works (I.e., the name of the
> bootstrap superuser comes is derived at initdb time from the environment
> executing initdb).

I agree that the docs are not incorrect as they stand, but maybe they
could be phrased a little more clearly.  The "Customarily," bit is perhaps
too terse.  I'm thinking about wording like

    This role is always a “superuser”, and by default it will have the
    same name as the operating system user that initialized the database
    cluster, unless another name is specified while running initdb.
    It is common, but not required, to arrange for this role to be named
    postgres.

            regards, tom lane



Re: Seeming contradiction in 22.1

From
maja zaloznik
Date:
Thanks David, this is very helpful!

I would have to agree with Tom, that while technically true, the text could be reworded. namely it was not obvious to me that i had used a 'packager' to install the clusters and therefore was doing something outside the purview of the postgres documentation.

To me the last sentence would be clearer if it read something like:

"Most packagers will name this role `postgres` by default, but this is not required".

That way it avoids the passive tense which leaves some ambiguity as to who or what and when is naming this superuser.

Best,
Maja 




On Thu, 23 Mar 2023, 16:09 Tom Lane, <tgl@sss.pgh.pa.us> wrote:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> The root issue, IMO, is that all packagers have settled on the convention
> of using Postgres for the superuser name, so if one only ever sees that, it
> is easy to assume it is some kind of default of the software itself.  In
> the face of consistent evidence, people not reading the documentation is my
> supposed assumption for their ignorance of this point.  But reading the
> docs, it is clear how the system really works (I.e., the name of the
> bootstrap superuser comes is derived at initdb time from the environment
> executing initdb).

I agree that the docs are not incorrect as they stand, but maybe they
could be phrased a little more clearly.  The "Customarily," bit is perhaps
too terse.  I'm thinking about wording like

    This role is always a “superuser”, and by default it will have the
    same name as the operating system user that initialized the database
    cluster, unless another name is specified while running initdb.
    It is common, but not required, to arrange for this role to be named
    postgres.

                        regards, tom lane

Re: Seeming contradiction in 22.1

From
Bruce Momjian
Date:
On Thu, Mar 23, 2023 at 05:45:03PM +0100, maja zaloznik wrote:
> Thanks David, this is very helpful!
> 
> I would have to agree with Tom, that while technically true, the text could be
> reworded. namely it was not obvious to me that i had used a 'packager' to
> install the clusters and therefore was doing something outside the purview of
> the postgres documentation.
> 
> To me the last sentence would be clearer if it read something like:
> 
> "Most packagers will name this role `postgres` by default, but this is not
> required".
> 
> That way it avoids the passive tense which leaves some ambiguity as to who or
> what and when is naming this superuser.

I think the paragraph was trying to do too much so I simplified it,
patch attached.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.

Attachment

Re: Seeming contradiction in 22.1

From
Bruce Momjian
Date:
On Wed, Sep 27, 2023 at 06:11:44PM -0400, Bruce Momjian wrote:
> On Thu, Mar 23, 2023 at 05:45:03PM +0100, maja zaloznik wrote:
> > Thanks David, this is very helpful!
> > 
> > I would have to agree with Tom, that while technically true, the text could be
> > reworded. namely it was not obvious to me that i had used a 'packager' to
> > install the clusters and therefore was doing something outside the purview of
> > the postgres documentation.
> > 
> > To me the last sentence would be clearer if it read something like:
> > 
> > "Most packagers will name this role `postgres` by default, but this is not
> > required".
> > 
> > That way it avoids the passive tense which leaves some ambiguity as to who or
> > what and when is naming this superuser.
> 
> I think the paragraph was trying to do too much so I simplified it,
> patch attached.

Patch applied to PG 16.  I didn't go further because this is only a
clarification, rather than missing or incorrect information, and the
patch didn't cleanly apply to PG 15.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.