fix: correct PGOPTIONS parsing and search_path handling #768
+260
−4
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.
What kind of change does this PR introduce?
Bug fix: improves PGOPTIONS parsing to correctly handle both
--key=valueand-c key=valuesyntax, prevent malformed tokens, and avoid leaking unintended parameters to Postgres.What is the current behavior?
Supavisor currently parses PGOPTIONS using
URI.decode_query, but PostgreSQL does not URI-encode connection options they are space-separated key=value pairs.This causes several issues:
-c key=valuesyntax is not supported--search_pathis first, following options are passed throughNote
In this case, Supavisor repeatedly tries to reconnect and floods the logs with:
[error] DbHandler: Error auth response ["SFATAL", "VFATAL", "C42601", "Minvalid command-line argument for server process: --search_path=custom", "HTry \"postgres --help\" for more information.", "Fpostgres.c", "L3931", "Rprocess_postgres_switches"]Related issues
What is the new behavior?
Additional context
Integration tests for this behavior are included in #770