generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
postgresql_set - Fix GUC_LIST_QUOTE parameters #521
Merged
hunleyd
merged 24 commits into
ansible-collections:main
from
RealGreenDragon:set_fix_guc_list_quote
Jul 13, 2023
Merged
postgresql_set - Fix GUC_LIST_QUOTE parameters #521
hunleyd
merged 24 commits into
ansible-collections:main
from
RealGreenDragon:set_fix_guc_list_quote
Jul 13, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RealGreenDragon
changed the title
postgresql_set - Fixed GUC_LIST_QUOTE parameters
postgresql_set - Fix GUC_LIST_QUOTE parameters
Jul 9, 2023
RealGreenDragon
requested review from
Andersson007,
hunleyd and
jchancojr
as code owners
July 9, 2023 19:38
Ready for review |
hunleyd
requested changes
Jul 10, 2023
tests/integration/targets/postgresql_set/tasks/options_coverage.yml
Outdated
Show resolved
Hide resolved
@hunleyd Change done, now ansible/third-party-check fails but I don't know why (seems it fails also for all other PRs) |
hunleyd
approved these changes
Jul 11, 2023
Co-authored-by: Andrew Klychkov <[email protected]>
Co-authored-by: Andrew Klychkov <[email protected]>
Andersson007
approved these changes
Jul 12, 2023
jchancojr
approved these changes
Jul 12, 2023
@RealGreenDragon thanks for the contribution! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
My PR fixes GUC_LIST_QUOTE parameters management in postgresql_set module.
GUC_LIST_QUOTE parameters are multi-value parameters (like GUC_LIST_INPUT parameters) whose elements are surrounded by double-quotes if not match
^[A-Za-z09_]+$
pattern.Now such double-quotes are ignored by postgresql_set module and it causes an always-changed status in these cases. It is a very serious bug if the parameter is a postmaster, as unix_socket_directories (it became GUC_LIST_QUOTE in PostgreSQL 14).
The bug has not seen until now as GUC_LIST_QUOTE parameters are few and many of them have not valid values that contain special characters (as shared_preload_libraries parameter).
Examples:
To solve the bug the only way is to hard-code GUC_LIST_QUOTE parameters list in the code (very short and static in the time) as there is no way to distinguish the case in with a parameter value need an unquote or not (specially with values composed by a single elements). The same approach is applied in pg_dump code (variable_is_guc_list_quote function).
Hard-code also the list of GUC_LIST_INPUT parameters is expensive and for now (I think) not necessary. However I added a check to not consider multi-value unix_socket_directories parameter until PostgreSQL 13, as only from PostgreSQL 14 GUC_LIST_INPUT and GUC_LIST_QUOTE options are added to that parameter.
In test added there is also a general idempotence check after a reboot (as unix_socket_directories parameter is postmaster).
ISSUE TYPE
COMPONENT NAME
postgresql_set
ADDITIONAL INFORMATION
@ PostgreSQL 14 -> Add GUC_LIST_INPUT and GUC_LIST_QUOTE to unix_socket_directories
postgres/postgres@a05dbf4
@ List of GUC params (PostgreSQL 15 only)
https://github.com/postgres/postgres/blob/5edf438eeb00271cca5d19d0ea10a2d6e8d018c4/src/backend/utils/misc/guc_tables.c
@ Fixed list of GUC_LIST_QUOTE params in each supported major version (variable_is_guc_list_quote function)
15 -> https://github.com/postgres/postgres/blob/8382864eb5c9f9ebe962ac20b3392be5ae304d23/src/bin/pg_dump/dumputils.c#L689
14 -> https://github.com/postgres/postgres/blob/b6cf730e80e8571066c0ce76e76ce99b9144c149/src/bin/pg_dump/dumputils.c#L849
13 -> https://github.com/postgres/postgres/blob/2faab87390b03929a8cbb5a9336a04faa45a27c5/src/bin/pg_dump/dumputils.c#L849
12 -> https://github.com/postgres/postgres/blob/117dd58fd9cd01e661a2c36977e16a2722306a6d/src/bin/pg_dump/dumputils.c#L849
11 -> https://github.com/postgres/postgres/blob/f96e531b1c079ae148b927a204845c7150a573f8/src/bin/pg_dump/dumputils.c#L849
10 -> https://github.com/postgres/postgres/blob/02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4/src/bin/pg_dump/dumputils.c#L846
9.6 -> https://github.com/postgres/postgres/blob/a4116b8d5a4f68803452d8f1aa3f74f302049a90/src/bin/pg_dump/dumputils.c#L853
9.5 -> https://github.com/postgres/postgres/blob/202c587e2f28bc295f6935d044e20680b627e7a1/src/bin/pg_dump/dumputils.c#L1536
9.4 -> https://github.com/postgres/postgres/blob/30ffdd24d7222bc01183a56d536c236240674516/src/bin/pg_dump/dumputils.c#L1537
@ GUC_LIST_QUOTE element quote function (quote_identifier function - PostgreSQL 15 only)
https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/ruleutils.c#L11930
@ GUC_LIST_INPUT/GUC_LIST_QUOTE elements split function (SplitGUCList function - PostgreSQL 15 only)
https://github.com/postgres/postgres/blob/6ee01e25b7f79bdf835d12927b306ad922c55fd3/src/backend/utils/adt/varlena.c#L3702