]> git.ipfire.org Git - thirdparty/psycopg.git/commit
fix: return the compiled port if PQport returns an empty string
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 8 May 2025 17:09:08 +0000 (19:09 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 9 May 2025 13:09:33 +0000 (15:09 +0200)
commit0b652519784f4d142d617d17dc52ab0e18c9a786
tree20eb4661516f09e5d93d20cc983232519cb9daef
parenteca02fb38fcdcd89d68d509c0616743c7b8319fd
fix: return the compiled port if PQport returns an empty string

Looking at the docs this seems the default value when an empty string is
specified, as opposite as the value in the PGPORT env var. See
<https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-PORT>.

This change is an improvement on top of 40dfa0b, where we allowed PGport
to return NULL. This is likely a libpq bug (reported in
<https://www.postgresql.org/message-id/CA%2Bmi_8YTS8WPZPO0PAb2aaGLwHuQ0DEQRF0ZMnvWss4y9FwDYQ%40mail.gmail.com>)
but now it's in the wild so we better support it rather than dying of
assert or by int()'ing an empty string.
docs/news.rst
psycopg/psycopg/_connection_info.py
tests/test_connection_info.py