Re: How to I select value of GUC that has - in its name?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to I select value of GUC that has - in its name?
Date: 2021-02-09 17:24:53
Message-ID: 20210209172453.GA29679@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2021-02-09 17:58:15 Re: How to I select value of GUC that has - in its name?
Previous Message Matt Zagrabelny 2021-02-09 17:06:32 quoted-printable to jsonb