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

From Jelte Fennema-Nio
Subject Re: BackendKeyData is mandatory?
Date
Msg-id CAGECzQSxGPVY8U1Wy8hMG=yeeVk35bP3Qr-Kkww4wZy=uFunyw@mail.gmail.com
Whole thread Raw
In response to Re: BackendKeyData is mandatory?  (Jacob Champion <jacob.champion@enterprisedb.com>)
List pgsql-hackers
On Thu, 3 Jul 2025 at 02:03, Jacob Champion
<jacob.champion@enterprisedb.com> wrote:
> Okay, wait -- JDBC was _copying_ our weird behavior? Why? Does
> something depend it in the wild?

I'm pretty sure there was no intent behind this, but it's simply
because our weird behaviour is the simplest from the client
implementation side with a fixed 4-byte key length:
1. Store two ints in a struct/class, these default to 0.
2. When you receive a BackendKeyData during startup update the two ints
3. When client wants to cancel, send a CancelRequest with the two ints.

So if step 2 is missed, then you send this all zero message. PgBouncer
has the same behaviour.



pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: Using failover slots for PG-non_PG logical replication
Next
From: Shinya Kato
Date:
Subject: Re: Extend COPY FROM with HEADER to skip multiple lines