Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER
Date: 2022-07-26 18:59:24
Message-ID: 2511599.1658861964@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> Reaction to this patch seems tentatively positive so far, so I have
> committed it. Maybe someone will still show up to complain ... but I
> think it's a good change, so I hope not.

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);

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-07-26 19:06:08 Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER
Previous Message Robert Haas 2022-07-26 18:40:49 Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER