Re: BackendKeyData is mandatory?

Jelte Fennema-Nio <postgres@jeltef.nl>

From: Jelte Fennema-Nio <postgres@jeltef.nl>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Jacob Champion <jacob.champion@enterprisedb.com>, Tatsuo Ishii <ishii@postgresql.org>, peter@eisentraut.org, pgsql-hackers@postgresql.org, Dave Cramer <davecramer@gmail.com>
Date: 2025-08-19T20:49:06Z
Lists: pgsql-hackers
On Thu, 14 Aug 2025 at 15:10, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> Here's a new set of patches, to disconnect on OOM instead of hanging or
> silently discarding messages:

Code looks good. Som small nitpicks though.

This change seems unnecessary, i.e. free(NULL) is a no-op

-        free(svname);
+        if (svname)
+            free(svname);


Small wording suggestion, maybe change this:

The caller has already saved the error message in conn->errorMessage.

to

The caller should have already saved the error message in conn->errorMessage.

or even

The caller should have already saved the error message using
libpq_append_conn_error.



Commits

  1. Revert unnecessary check for NULL

  2. libpq: Be strict about cancel key lengths

  3. libpq: Handle OOM by disconnecting instead of hanging or skipping msgs

  4. libpq: Complain about missing BackendKeyData later with PGgetCancel()