]> granicus.if.org Git - postgresql/commitdiff
Fix error reporting of connect_timeout in libpq for value parsing
authorMichael Paquier <michael@paquier.xyz>
Mon, 21 Oct 2019 02:39:28 +0000 (11:39 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 21 Oct 2019 02:39:28 +0000 (11:39 +0900)
The logic was correctly detecting a parsing failure, but the parsing
error did not get reported back to the client properly.

Reported-by: Ed Morley
Author: Lars Kanis
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/a9b4cbd7-4ecb-06b2-ebd7-1739bbff3217@greiz-reinsdorf.de
Backpatch-through: 12

src/interfaces/libpq/fe-connect.c

index 957b9d26c132d488d30458847b459715982f5feb..9088c4cbce72ea5f272dc0766baaf05bdaadcb9e 100644 (file)
@@ -1992,7 +1992,11 @@ connectDBComplete(PGconn *conn)
        {
                if (!parse_int_param(conn->connect_timeout, &timeout, conn,
                                                         "connect_timeout"))
+               {
+                       /* mark the connection as bad to report the parsing failure */
+                       conn->status = CONNECTION_BAD;
                        return 0;
+               }
 
                if (timeout > 0)
                {