pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <bruce@momjian.us>
Cc: axos88@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15271: Documentation / Error reporting on GUC parameter change
Date: Tue, 07 Aug 2018 15:10:09 -0400
Message-ID: <29540.1533669009@sss.pgh.pa.us> (raw)
In-Reply-To: <20180807172340.GC7297@momjian.us>
References: <153121314370.1402.3836688647018870326@wrigleys.postgresql.org>
	<20180807172340.GC7297@momjian.us>

Bruce Momjian <bruce@momjian.us> writes:
> I looked at this report and the cause seems deeper than reported.  The
> reporter states that having the extension loaded would fix it, but doing
> the ALTER DATABASE as superuser also fixes it:

Well, yeah, see guc.c's validate_option_array_item:

     * There are three cases to consider:
     *
     * name is a known GUC variable.  Check the value normally, check
     * permissions normally (i.e., allow if variable is USERSET, or if it's
     * SUSET and user is superuser).
     *
     * name is not known, but exists or can be created as a placeholder (i.e.,
     * it has a prefixed name).  We allow this case if you're a superuser,
     * otherwise not.  Superusers are assumed to know what they're doing. We
     * can't allow it for other users, because when the placeholder is
     * resolved it might turn out to be a SUSET variable;
     * define_custom_variable assumes we checked that.
     *
     * name is not known and can't be created as a placeholder.  Throw error,
     * unless skipIfNoPermissions is true, in which case return false.

AFAICS it's behaving as designed.

Conceivably we could improve this by extending pg_db_role_setting to track
whether the assigner of a value was superuser or not, and then deciding
at value apply time whether to allow the assignment.  However, that would
have downsides of its own, that you might not find out till far distant
from the mistake that you'd made a mistake.

			regards, tom lane




view thread (8+ messages)  latest in thread

Message-ID: <29540.1533669009@sss.pgh.pa.us>
Permalink:  ../29540.1533669009@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29540.1533669009@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bruce@momjian.us, axos88@gmail.com
  Subject: Re: BUG #15271: Documentation / Error reporting on GUC parameter change
  In-Reply-To: <29540.1533669009@sss.pgh.pa.us>
  References: <153121314370.1402.3836688647018870326@wrigleys.postgresql.org> <20180807172340.GC7297@momjian.us> <29540.1533669009@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox