Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fn7mp-0008EU-4C for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Aug 2018 19:36:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fn7mn-0000xv-2U for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Aug 2018 19:36:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fn7mm-0000xo-T1 for pgsql-bugs@lists.postgresql.org; Tue, 07 Aug 2018 19:36:52 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fn7mj-0007jK-Pu for pgsql-bugs@lists.postgresql.org; Tue, 07 Aug 2018 19:36:52 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1fn7mh-0007l8-U1; Tue, 07 Aug 2018 15:36:47 -0400 Date: Tue, 7 Aug 2018 15:36:47 -0400 From: Bruce Momjian To: Tom Lane Cc: axos88@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15271: Documentation / Error reporting on GUC parameter change Message-ID: <20180807193647.GI7297@momjian.us> References: <153121314370.1402.3836688647018870326@wrigleys.postgresql.org> <20180807172340.GC7297@momjian.us> <29540.1533669009@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29540.1533669009@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Aug 7, 2018 at 03:10:09PM -0400, Tom Lane wrote: > Bruce Momjian 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. Great, thanks for the background. It is probably not worth trying to enhance this further. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription +