Re: BackendKeyData is mandatory?
Jelte Fennema-Nio <postgres@jeltef.nl>
From: "Jelte Fennema-Nio" <postgres@jeltef.nl>
To: "Jacob Champion" <jacob.champion@enterprisedb.com>
Cc: "Tatsuo Ishii" <ishii@postgresql.org>, <tgl@sss.pgh.pa.us>,
<hlinnaka@iki.fi>, <peter@eisentraut.org>, <pgsql-hackers@postgresql.org>
Date: 2025-06-25T07:12:05Z
Lists: pgsql-hackers
Attachments
- v1-0001-libpq-Complain-about-missing-BackendKeyData-later.patch (text/x-patch) patch v1-0001
- v1-0002-libpq-Disallow-cancel-keys-longer-than-256-bytes.patch (text/x-patch) patch v1-0002
On Tue Jun 24, 2025 at 5:07 PM CEST, Jacob Champion wrote: > So that's > 1) return an (empty) cancellation object even if the server has not > sent a key, and > 2) error out when trying to cancel with an empty object? > > That sounds reasonable to me. Attached is an attempt at implementing the above. I did not test it against these systems though. I also added small commit that checks for the 256 byte key length limit described in the protocol documentation. This thread made me remember that we talked about that during PGConf.dev.
Commits
-
Revert unnecessary check for NULL
- 5a26a3e4eeb2 18.0 landed
- 807ee417e562 19 (unreleased) landed
-
libpq: Be strict about cancel key lengths
- e7ff96853ea7 18.0 landed
- e411a8d25a4b 19 (unreleased) landed
-
libpq: Handle OOM by disconnecting instead of hanging or skipping msgs
- 8aa287c9061b 18.0 landed
- f6f0542266f0 19 (unreleased) landed
-
libpq: Complain about missing BackendKeyData later with PGgetCancel()
- 42b1480eb2c6 18.0 landed
- a4801eb691ed 19 (unreleased) landed