Re: Assertion failure on reload of GUC_SUPERUSER_ONLY parms - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Assertion failure on reload of GUC_SUPERUSER_ONLY parms
Date
Msg-id 1020.1254585261@sss.pgh.pa.us
Whole thread Raw
In response to Assertion failure on reload of GUC_SUPERUSER_ONLY parms  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-bugs
Simon Riggs <simon@2ndQuadrant.com> writes:
> It looks to me like the correct fix would be to use
> GetUserIdAndContext() instead, though I would suggest inventing
> GetUserIdIfAny() which would skip the assertion test for use in
> superuser().

You are thinking at the wrong abstraction level.  Even to ask if
the user is superuser is inappropriate in the postmaster, since
there is no user.  So I think the bug is that GetConfigOption
is calling superuser() when it is now possible for it to be used
in the postmaster.

The quick & dirty fix would be to add IsUnderPostmaster to the
check in GetConfigOption.  Or we could refactor things so that
the GUC_SUPERUSER_ONLY check is applied at some higher level;
but that's probably more work than it's worth.

It looks to me like the pstrdup that was added in guc-file.l
represents a permanent memory leak in the postmaster, too :-(

            regards, tom lane

pgsql-bugs by date:

Previous
From: Simon Riggs
Date:
Subject: Assertion failure on reload of GUC_SUPERUSER_ONLY parms
Next
From: Robert Haas
Date:
Subject: Re: BUG #5083: Problem create account.