fix: use psycopg2 instead of psycopg2-binary to link against system libpq#370
Open
fix: use psycopg2 instead of psycopg2-binary to link against system libpq#370
Conversation
…ibpq psycopg2-binary bundles its own libpq 9.6, which does not support the target_session_attrs connection parameter (requires libpq >= 10). This causes Patroni replicas to log errors every second: psycopg2.ProgrammingError: invalid dsn: invalid connection option "target_session_attrs" The error originates in Patroni's rewind.py check_leader_is_not_in_recovery(), which sets target_session_attrs='read-write' for PG >= 10. Switching to psycopg2 (non-binary) compiles from source against the system's libpq-dev, which fully supports the parameter. libpq-dev is already present via the postgresql-server-dev dependency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or 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
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.
psycopg2-binarybundles its ownlibpq 9.6, which does not support thetarget_session_attrsconnection parameter (requireslibpq >= 10).This causes Patroni replicas to log errors every second:
psycopg2.ProgrammingError: invalid dsn: invalid connection option "target_session_attrs"The error originates in Patroni's
rewind.pycheck_leader_is_not_in_recovery(), which setstarget_session_attrs='read-write'forPG >= 10.Switching to
psycopg2(non-binary) compiles from source against the system'slibpq-dev, which fully supports the parameter.libpq-devis already present via thepostgresql-server-devdependency.