Re: BUG #15646: Inconsistent behavior for current_setting/set_config

From: Jerry Sievert <jerry(at)legitimatesounding(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Joe Conway <mail(at)joeconway(dot)com>, KES <kes-kes(at)yandex(dot)ru>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15646: Inconsistent behavior for current_setting/set_config
Date: 2019-02-20 18:06:07
Message-ID: BFCCBA3C-9BD3-4B95-9873-15EFA4CC7E07@legitimatesounding.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hi,

> On Feb 20, 2019, at 9:32 AM, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> Users should be
> informed that as far as the GUC system is concerned NULL and the empty
> string are equivalent and that resetting uses the empty string while
> never being set returns NULL.
>

Except that it’s not - the code path in guc.c uses what is passed as the boot value:

var->boot_val <https://doxygen.postgresql.org/structconfig__string.html#ad6895b2d95aa9e5c3ff2169d7fe2bc20> = bootValue;

It’s up to the extension developer to understand that this can be changed back to something other than the boot value and not actually be the boot value - you can see this assumption being made in plpgsql, pltcl, and plperl. The GUC system makes no notification that the two are equivalent, neither in code nor in documentation.

> Its immaterial whether its existence is due to a bug that simply
> became acceptable or was an otherwise retrospectively poor design
> decision - at this point we have to live with it and should treat it
> as a proper and supported feature, if only in its current form. At
> least until someone feels strongly enough to deprecate it and put
> something else more suitable in its place.

Agreed, but it needs to be documented, the current documentation gives only the boot value, and does not note that string variables are the only variables that behave differently and do not return to their boot value.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Joe Conway 2019-02-20 18:51:57 Re: BUG #15646: Inconsistent behavior for current_setting/set_config
Previous Message Andre Piwoni 2019-02-20 17:58:12 Re: BUG #15638: pg_basebackup with --wal-method=stream incorrectly generates WAL segment created during backup

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-02-20 18:09:08 Re: Protect syscache from bloating with negative cache entries
Previous Message Alvaro Herrera 2019-02-20 17:38:15 Re: propagating replica identity to partitions