Re: is_superuser versus set_config_option's parallelism check

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org, Robert Haas <robertmhaas@gmail.com>
Date: 2024-08-09T19:26:44Z
Lists: pgsql-hackers
On Fri, Aug 09, 2024 at 02:43:59PM -0400, Tom Lane wrote:
> The simplest fix would be to hack this test to allow the action anyway
> when context == PGC_INTERNAL, excusing that as "assume the caller
> knows what it's doing".  That feels pretty grotty though.  Perhaps
> a cleaner way would be to move this check to some higher code level,
> but I'm not sure where would be a good place.

From a couple of quick tests, it looks like setting
"current_role_is_superuser" directly works.  That's still grotty, but at
least the grottiness would be localized and not require broad assumptions
about callers knowing what they're doing when using PGC_INTERNAL.  I
wouldn't be surprised if there are other problems with this approach, too.

-- 
nathan



Commits

  1. Allow adjusting session_authorization and role in parallel workers.

  2. Fix failure to verify PGC_[SU_]BACKEND GUCs in pg_file_settings view.