Re: BackendKeyData is mandatory? - Mailing list pgsql-hackers

From Jacob Champion
Subject Re: BackendKeyData is mandatory?
Date
Msg-id CAOYmi+mt2JvjmhVJs=PgKLruZsypskmiECOUCrvV4QgjCWRhCA@mail.gmail.com
Whole thread Raw
In response to Re: BackendKeyData is mandatory?  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Responses Re: BackendKeyData is mandatory?
List pgsql-hackers
On Thu, Jun 19, 2025 at 5:12 AM Jelte Fennema-Nio <postgres@jeltef.nl> wrote:
> I'd be surprised if many clients handle it correctly if it is not
> sent. Looking quickly at the code for pgbouncer and libpq for PG17
> (and lower) they definitely don't. They won't throw an error, but
> instead of doing nothing when the user tries to cancel a query they
> will instead send a cancel message with all zeros to the server. Since
> PG18 libpq handles a cancel call nicely as a no-op, when no cancel key
> was received.

If anyone today is relying on "backend-key-less" connection, this is
potentially a breaking change. For example, psycopg2 now complains:

    psycopg2.OperationalError: can't get cancellation key

whereas before, it would be able to connect, and sending a cancel
would do something. (Whether or not that "something" was useful was up
to the server implementation, I guess.)

--Jacob



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: problems with toast.* reloptions
Next
From: jian he
Date:
Subject: Re: pg18: Virtual generated columns are not (yet) safe when superuser selects from them