Re: Reserve prefixes for loaded libraries proposal

Поиск
Список
Период
Сортировка
От Florin Irion
Тема Re: Reserve prefixes for loaded libraries proposal
Дата
Msg-id CA+HEvJCF8KQEJ1rH-E8o5JVaWz9SEDqKeiNzTNAQkyL_rDTwKA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Reserve prefixes for loaded libraries proposal  (Chapman Flack <chap@anastigmatix.net>)
Ответы Re: Reserve prefixes for loaded libraries proposal
Список pgsql-hackers


Il giorno ven 1 ott 2021 alle ore 00:26 Chapman Flack <chap@anastigmatix.net> ha scritto:
>
> On 09/30/21 17:54, Florin Irion wrote:
>
> > We could also help users get a warning if they set a parameter with the
> > `SET` command.
>
> This is funny. For years I have been so confident I knew how this worked
> that I, obviously, hadn't tried it. :)
>
> My first setting of a made-up variable gets no warning, as I already expected:
>
> postgres=# set plpgsql.no_such_setting = false;
> SET
>
> Then as soon as I do the first thing in the session involving plpgsql,
> I get the warning for that one:
>
> postgres=# do language plpgsql
> postgres-# 'begin delete from pg_class where false; end';
> WARNING:  unrecognized configuration parameter "plpgsql.no_such_setting"
> DO
>

I choose `plpgsql` in my example because perhaps it is best known to the
majority, plpgsql gets loaded when the user first uses it, and doesn't need
to be preloaded at startup.  
This proposal will help when we have any extension in the `shared_preload_libraries`
and the check is only made at postgres start.
However, if one already used plpgsql in a session and then it `SET`s an unknown parameter
it will not get any warning as the check is made only when it gets loaded the first time.

```
postgres=# do language plpgsql
'begin delete from pg_class where false; end';
DO
postgres=# set plpgsql.no_such_setting = false;
SET
postgres=# do language plpgsql
'begin delete from pg_class where false; end';
DO
```

With my patch it will be registered and it will throw a warning also in this case:

```
postgres=# do language plpgsql
postgres-# 'begin delete from pg_class where false; end';
DO
postgres=# set plpgsql.no_such_setting = false;
WARNING:  unrecognized configuration parameter "plpgsql.no_such_setting"
DETAIL:  "plpgsql" is a reserved prefix.
HINT:  If you need to create a custom placeholder use a different prefix.
SET
```

>
> But then, I have always assumed I would get warnings thereafter:
>
> postgres=# set plpgsql.not_this_one_neither = false;
> SET
>
> But no!

Exactly.

> So I am in favor of patching this.
>
> Regards,
> -Chap

Thanks,
Florin Irion

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: pg_receivewal starting position
Следующее
От: Daniel Gustafsson
Дата:
Сообщение: Re: postgres_fdw: Handle boolean comparison predicates