Re: is_superuser is not documented - Mailing list pgsql-hackers

From Tom Lane
Subject Re: is_superuser is not documented
Date
Msg-id 158976.1662742601@sss.pgh.pa.us
Whole thread Raw
In response to Re: is_superuser is not documented  ("Euler Taveira" <euler@eulerto.com>)
Responses Re: is_superuser is not documented
List pgsql-hackers
"Euler Taveira" <euler@eulerto.com> writes:
> On Fri, Sep 9, 2022, at 2:28 AM, bt22kawamotok wrote:
>> is_superuser function checks whether a user is a superuser or not, and
>> is commonly used. However, is_superuser is not documented and is set to
>> UNGROUPED in guc.c. I think is_superuser should be added to the
>> documentation and set to PRESET OPTIONS.What are you thought on this?

> There is no such function. Are you referring to the GUC? I agree that it should
> be added to the documentation.

If you look at guc.c, it kind of seems intentional that it's undocumented:

        /* Not for general use --- used by SET SESSION AUTHORIZATION */
        {"is_superuser", PGC_INTERNAL, UNGROUPED,
            gettext_noop("Shows whether the current user is a superuser."),
            NULL,
            GUC_REPORT | GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
        },
        &session_auth_is_superuser,
        false,
        NULL, NULL, NULL

On the other hand, it seems pretty silly that it's GUC_REPORT if
we want to consider it private.  I've not checked the git history,
but I bet that flag was added later with no thought about context.

If we are going to document this then we should at least remove
the GUC_NO_SHOW_ALL flag and rewrite the comment.  I wonder whether
the GUC_NO_RESET_ALL flag is needed either --- seems like the
PGC_INTERNAL context protects it sufficiently.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Add the ability to limit the amount of memory that can be allocated to backends.
Next
From: Tom Lane
Date:
Subject: Re: Remove redundant code in pl_exec.c