pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <depesz@depesz.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general mailing list <pgsql-general@postgresql.org>
Subject: Re: How to I select value of GUC that has - in its name?
Date: Tue, 9 Feb 2021 18:24:53 +0100
Message-ID: <20210209172453.GA29679@depesz.com> (raw)
In-Reply-To: <866534.1612890042@sss.pgh.pa.us>
References: <20210209144059.GA21360@depesz.com>
	<d4868bd3-5e42-8dcc-4e40-938140f76009@aklaver.com>
	<20210209154502.GA2409@depesz.com>
	<0564844d-4dda-9162-13b5-4c95c4340e95@aklaver.com>
	<866534.1612890042@sss.pgh.pa.us>

> Sure enough,
> regression=> show custom."bad-guc";
> ERROR:  unrecognized configuration parameter "custom.bad-guc"
> regression=> show custom."bad_guc";
>  custom.bad_guc 
> ----------------
>  1a
> (1 row)
> So that's where the setting went.

Oh, that's interesting. Unfortuantley it can also lead to problems:
alter user depesz set custom.bad_guc='2b';
$ select * from pg_db_role_setting where setrole = 'depesz'::regrole;
  setdatabase │ setrole │                                 setconfig                                 
 ─────────────┼─────────┼───────────────────────────────────────────────────────────────────────────
            0 │   16384 │ {application_name=xxx,custom.guc=123,custom.bad-guc=1a,custom.bad_guc=2b}
(1 row)

And now I can get:
$ show custom."bad_guc";
 custom.bad_guc 
────────────────
 2b
(1 row)

But the bad-guc is no longer available.

> (Fortunately, ALTER USER SET with a custom GUC is superuser-only,
> so there's no need to worry about security issues here.  But we
> should eliminate surprises.)

Yeah. Realistically I wouldn't use variable names with - in them, but some people clearly are trying.

Thanks, and best regards,

depesz





view thread (9+ messages)  latest in thread

Message-ID: <20210209172453.GA29679@depesz.com>
Permalink:  ../20210209172453.GA29679@depesz.com/
Also on:    postgresql.org/message-id/20210209172453.GA29679@depesz.com

 · 

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-general@postgresql.org
  Cc: depesz@depesz.com, tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com
  Subject: Re: How to I select value of GUC that has - in its name?
  In-Reply-To: <20210209172453.GA29679@depesz.com>
  References: <20210209144059.GA21360@depesz.com> <d4868bd3-5e42-8dcc-4e40-938140f76009@aklaver.com> <20210209154502.GA2409@depesz.com> <0564844d-4dda-9162-13b5-4c95c4340e95@aklaver.com> <866534.1612890042@sss.pgh.pa.us> <20210209172453.GA29679@depesz.com>

* 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