[PATCH] SET search_path += octopus
От | Abhijit Menon-Sen |
---|---|
Тема | [PATCH] SET search_path += octopus |
Дата | |
Msg-id | 20200928033924.GA998042@toroid.org обсуждение исходный текст |
Ответы |
Re: [PATCH] SET search_path += octopus
Re: [PATCH] SET search_path += octopus Re: [PATCH] SET search_path += octopus |
Список | pgsql-hackers |
Hi. The first attached patch (0001-Accept-SET-xyz-pqr-to-add-pqr-to-the-current-setting.patch) adds support for commands like the following, applicable to any configuration settings that are represented as a comma-separated list of strings (i.e., GUC_LIST_INPUT): postgres=# SET search_path += octopus; SET postgres=# SET search_path += "giant squid", kraken, narwhal; -- [1] SET postgres=# SET search_path -= public, narwhal; SET postgres=# SHOW search_path; ┌─────────────────────────────────────────┐ │ search_path │ ├─────────────────────────────────────────┤ │ "$user", octopus, "giant squid", kraken │ └─────────────────────────────────────────┘ (1 row) The implementation extends to ALTER SYSTEM SET with next to no effort, so you can also add entries to shared_preload_libraries without having to know its current value: ALTER SYSTEM SET shared_preload_libraries += auto_explain; The second patch (0002-Support-SET-syntax-for-numeric-configuration-setting.patch) adds support to modify numeric configuration settings: postgres=# SET cpu_tuple_cost += 0.02; SET postgres=# SET effective_cache_size += '2GB'; SET postgres=# SHOW effective_cache_size; ┌──────────────────────┐ │ effective_cache_size │ ├──────────────────────┤ │ 6GB │ └──────────────────────┘ (1 row) postgres=# ALTER SYSTEM SET max_worker_processes += 4; ALTER SYSTEM Being able to safely modify shared_preload_libraries (in particular) and max_worker_processes during automated extension deployments is a problem I've struggled with more than once in the past. These patches do not affect configuration file parsing in any way: its use is limited to "SET" and "ALTER xxx SET". (After I started working on this, I came to know that this idea has been proposed in different forms in the past, and objections to those proposals centred around various difficulties involved in adding this syntax to configuration files. I'm not particularly fond of that idea, and it's not what I've done here.) (Another feature that could be implemented using this framework is to ensure the current setting is at least as large as a given value: ALTER SYSTEM SET shared_buffers >= '8GB'; This would not change shared_buffers if it were already larger than 8GB. I have not implemented this, pending feedback on what's already there, but it would be simple to do.) Comments welcome. -- Abhijit 1. This feature supports a wide variety of marine creatures, with no implied judgement about their status, real or mythical; however, adding them to shared_preload_libraries is not advisable.
Вложения
В списке pgsql-hackers по дате отправления: