Re: libpq support for NegotiateProtocolVersion

From: Jacob Champion <jchampion(at)timescale(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: libpq support for NegotiateProtocolVersion
Date: 2022-11-16 18:35:02
Message-ID: CAAWbhmjodNxiqV0fWJZJpq5qU0Y_StTTbL8W+SgDPayLrDdXTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 15, 2022 at 2:19 AM Peter Eisentraut
<peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
> I think for the current code, the following would be an appropriate
> adjustment:
>
> diff --git a/src/interfaces/libpq/fe-connect.c
> b/src/interfaces/libpq/fe-connect.c
> index 746e9b4f1efc..d15fb96572d9 100644
> --- a/src/interfaces/libpq/fe-connect.c
> +++ b/src/interfaces/libpq/fe-connect.c
> @@ -3412,8 +3412,7 @@ PQconnectPoll(PGconn *conn)
> /* Get the type of request. */
> if (pqGetInt((int *) &areq, 4, conn))
> {
> - /* We'll come back when there are more data */
> - return PGRES_POLLING_READING;
> + goto error_return;
> }
> msgLength -= 4;
>
> And then the handling of the 'v' message in my patch would also be
> adjusted like that.

Yes -- though that particular example may be dead code, since we
should have already checked that there are at least four more bytes in
the buffer.

--Jacob

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-11-16 18:51:06 Re: when the startup process doesn't (logging startup delays)
Previous Message Andres Freund 2022-11-16 18:26:49 Re: Assertion failure in SnapBuildInitialSnapshot()