[PATCH] Correct the version sent in protocol negotiation

Started by Ning Sun4 months ago3 messagesdocs
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t139889
psql -h localhost -U postgres

Built from patchset v1 (message #1), September 20, 2026 at 07:50 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t139889_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t139889_1 && git checkout t139889_1

Patchset v1 (message #1) is on t139889_1

Jump to latest
#1Ning Sun
classicning@gmail.com

Our protocol doc describes protocol negotiation message will send latest
minor version. However that field is a 4-byte one. The actual
implementation sends full version including the major part:

static void
SendNegotiateProtocolVersion(List *unrecognized_protocol_options)
{
    StringInfoData buf;
    ListCell   *lc;

    pq_beginmessage(&buf, PqMsg_NegotiateProtocolVersion);
    pq_sendint32(&buf, FrontendProtocol);
    pq_sendint32(&buf, list_length(unrecognized_protocol_options));
    foreach(lc, unrecognized_protocol_options)
        pq_sendstring(&buf, lfirst(lc));
    pq_endmessage(&buf);

    /* no need to flush, some other message will follow */
}

The patch included just clarifies this behavior by removing "minor" from
"newest minor version".

Attachments:

t139889_1
0001-Protocol-negotiation-sends-full-version-instead-of-m.patchtext/x-patch; charset=UTF-8; name=0001-Protocol-negotiation-sends-full-version-instead-of-m.patchDownload+4-5
#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Ning Sun (#1)
Re: [PATCH] Correct the version sent in protocol negotiation

On Sun, 2026-06-07 at 10:00 +0800, Ning Sun wrote:

Our protocol doc describes protocol negotiation message will send latest
minor version. However that field is a 4-byte one. The actual
implementation sends full version including the major part:

The patch included just clarifies this behavior by removing "minor" from
"newest minor version".

To my understanding, the "minor version" is the entire version *including*
the last number, like 18.4 (and not only .4).

In this, I seem to be in agreement with
https://www.postgresql.org/support/versioning/

To me, removing the "minor" makes the text less clear. If we change that
at all, perhaps a wording like "the full version, including the minor
release" would remove any ambiguity.

Yours,
Laurenz Albe

#3Ning Sun
classicning@gmail.com
In reply to: Laurenz Albe (#2)
Re: [PATCH] Correct the version sent in protocol negotiation

I see. The "minor version"  has its own meaning in postgres context.

That makes sense. Thank you for clarification, Laurenz.

Show quoted text

On 07/06/2026 13:06, Laurenz Albe wrote:

On Sun, 2026-06-07 at 10:00 +0800, Ning Sun wrote:

Our protocol doc describes protocol negotiation message will send latest
minor version. However that field is a 4-byte one. The actual
implementation sends full version including the major part:

The patch included just clarifies this behavior by removing "minor" from
"newest minor version".

To my understanding, the "minor version" is the entire version *including*
the last number, like 18.4 (and not only .4).

In this, I seem to be in agreement with
https://www.postgresql.org/support/versioning/

To me, removing the "minor" makes the text less clear. If we change that
at all, perhaps a wording like "the full version, including the minor
release" would remove any ambiguity.

Yours,
Laurenz Albe