Fix sslsni boolean to integer conversion for libpq compatibility

The sslsni connection parameter was being stored as a boolean (true/false)
in the database, but libpq expects integer values (1/0) for this parameter.
When a boolean value was passed to libpq, it resulted in SSL connection
failures with 'unexpected eof while reading' errors.

This fix converts boolean connection parameters (sslcompression, sslsni) to
integers when creating the connection string in server_manager.py, ensuring
libpq receives the expected integer format.

Fixes connection issues when using PGSSLSNI=1 with PostgreSQL 14+ servers.
pull/9521/head
Jørgen H. Fjeld 2026-01-14 08:01:36 +01:00 committed by GitHub
parent 74c8b2d0a1
commit 402ddafa2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -690,6 +690,10 @@ WHERE db.oid = {0}""".format(did))
if key == 'hostaddr' and self.use_ssh_tunnel:
continue
# Convert boolean connection parameters to integer for libpq compatibility
if key in ('sslcompression', 'sslsni'):
value = 1 if value else 0
dsn_args[key] = value
display_dsn_args[key] = orig_value if with_complete_path else \
value