Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Nathan Bossart <nathandbossart@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2022-07-26T19:06:08Z
Lists: pgsql-hackers
On Tue, Jul 26, 2022 at 2:59 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I had not actually read the patch, but now that I have, it's got
> a basic typing error:
>
> +       bool    should_be_super = BoolGetDatum(boolVal(dissuper->arg));
> +
> +       if (!should_be_super && roleid == BOOTSTRAP_SUPERUSERID)
> +           ereport(ERROR,
>
> The result of BoolGetDatum is not bool, it's Datum.  This is
> probably harmless, but it's still a typing violation.
> You want something like
>
>         bool    should_be_super = boolVal(dissuper->arg);
>         ...
>         new_record[Anum_pg_authid_rolsuper - 1] = BoolGetDatum(should_be_super);

Oops. Will fix.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



Commits

  1. Fix brain fade in e530be2c5ce77475d56ccf8f4e0c4872b666ad5f.

  2. Do not allow removal of superuser privileges from bootstrap user.