libpq: Fix wrong connection status on invalid "connect_timeout" - Mailing list pgsql-hackers

From Lars Kanis
Subject libpq: Fix wrong connection status on invalid "connect_timeout"
Date
Msg-id a9b4cbd7-4ecb-06b2-ebd7-1739bbff3217@greiz-reinsdorf.de
Whole thread Raw
Responses Re: libpq: Fix wrong connection status on invalid "connect_timeout"
List pgsql-hackers
Greetings,

libpq since PostgreSQL-12 has stricter checks for integer values in
connection parameters. They were introduced by commit
https://github.com/postgres/postgres/commit/e7a2217978d9cbb2149bfcb4ef1e45716cfcbefb
.

However in case of "connect_timeout" such an invalid integer value leads
to a connection status other than CONNECTION_OK or CONNECTION_BAD. The
wrong parameter is therefore not properly reported to user space. This
patch fixes this by explicit setting CONNECTION_BAD.

The issue was raised on ruby-pg: https://github.com/ged/ruby-pg/issues/302

It originally came up at Heroku:
https://github.com/heroku/stack-images/issues/147

--

Kind Regards,
Lars Kanis


Attachment

pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Non working timeout detection in logical worker
Next
From: Lars Kanis
Date:
Subject: Re: libpq: Fix wrong connection status on invalid "connect_timeout"