Reserve prefixes for loaded libraries proposal

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

If we set a parameter in the postgresql.conf that the loaded library doesn't
recognize at startup, it throws a warning.
For example if one sets `plpgsql.no_such_setting` for plpgsql:

```
WARNING: unrecognized configuration parameter "plpgsql.no_such_setting"
```

We could also help users get a warning if they set a parameter with the `SET`
command. I've seen many cases where users make typos and break things badly,
check the following example:

```
postgres=# BEGIN;
BEGIN
postgres=*# SET plpgsql.no_such_setting = false;
SET
postgres=*# -- do critical queries taking into account that plpgsql.no_such_setting is false;
postgres=*# COMMIT;
COMMIT
```

I propose to make the user aware of such mistakes. I also made the patch only
to warn the user but still correctly `SET` the parameter so that he is the one
that chooses if he wants to continue or `ROLLBACK`. I don't know if this last
part is correct, but at least it doesn't break any previous implementation.

This is what I mean:

```
postgres=# BEGIN;
BEGIN
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
postgres=*# -- choose to continue or not based on the warning
postgres=*# ROLLBACK or COMMIT
```

The patch I'm attaching is registering the prefix for all the loaded libraries,
and eventually, it uses them to check if any parameter is recognized,just as we
do at startup.

Please, let me know what you think.

Cheers,
Florin Irion

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: PATH manipulation in 001_libpq_pipeline.pl fails on windows
Следующее
От: David Rowley
Дата:
Сообщение: Re: Record a Bitmapset of non-pruned partitions