Commit d73a35c
committed
fix(pgsql): handle PostgreSQL list-type GUC parameters correctly (#689)
PostgreSQL has certain GUC parameters that accept comma-separated lists
(marked with GUC_LIST_INPUT flag). These parameters must NOT have their
entire value wrapped in quotes, otherwise PostgreSQL treats the whole
string as a single value rather than parsing it as a comma-separated list.
Problem:
In v4.0.0, the parameter templates were changed to quote all values:
ALTER USER "x" SET "search_path" = '"$user", public'; -- WRONG
This causes search_path to be stored as ONE string instead of a list.
Solution:
Use a whitelist approach to identify list-type parameters and render
them without outer quotes:
ALTER USER "x" SET "search_path" = "$user", public; -- CORRECT
Affected parameters by context level:
User/Role level (pg-user.sql, pg-init-roles.sql):
- search_path
- temp_tablespaces
- local_preload_libraries
- session_preload_libraries
Database level (pg-db.sql):
- Above parameters plus log_destination
Instance level (patroni.yml -> postgresql.auto.conf):
- Above parameters plus:
- shared_preload_libraries
- unix_socket_directories
- debug_io_direct
Also adds missing condition for pg_watchdog task to skip when
patroni_watchdog_mode is set to 'off'.
Fixes: #6891 parent 24e75c6 commit d73a35c
File tree
4 files changed
+20
-0
lines changed- roles/pgsql
- tasks
- templates
4 files changed
+20
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| 67 | + | |
66 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
67 | 72 | | |
| 73 | + | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
| |||
216 | 222 | | |
217 | 223 | | |
218 | 224 | | |
| 225 | + | |
219 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
220 | 230 | | |
| 231 | + | |
221 | 232 | | |
222 | 233 | | |
223 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| 88 | + | |
| 89 | + | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| 83 | + | |
| 84 | + | |
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| 88 | + | |
| 89 | + | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
| |||
0 commit comments