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

From Jelte Fennema-Nio
Subject Re: BackendKeyData is mandatory?
Date
Msg-id CAGECzQT-NJX8b1ENJnErkZEmc9y5m6VgzVaLmH4gFutd0W6KbA@mail.gmail.com
Whole thread Raw
In response to Re: BackendKeyData is mandatory?  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: BackendKeyData is mandatory?
List pgsql-hackers
On Tue, 29 Jul 2025 at 22:42, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> I'm not quite sold on the change to PQcancelCreate(). The current
> behavior seems nicer: if cancellation is not available because the
> server didn't send a cancellation key, PQcancelCreate() returns a
> (cancel) connection object that's in a failed state with an error
> message explaining what's wrong. The client can choose to continue
> without cancellation capability, or bail out.
>
> Are there any known drivers that require the change to PQcancelCreate()?

I scoured github search[1] and it seems that (sadly) the only two
libraries (on github) that actually use PQcancelCreate are psycopg3
and ruby-pg. Both of those only create the object when they actually
want to cancel something (not when they use it). So I agree that the
change in bahaviour in PG18 for this function seems fine, and probably
is desirable. So feel free to commit my previous patch without the
changes to PQcancelCreate.


[1]:
https://github.com/search?q=PQcancelCreate+NOT+path%3A%2F%5C%2Fpsycopg%5C%2Fpq%5C%2F%2F+NOT+path%3A%2F%5C%2Fpsycopg_c%5C%2Fpq%5C%2F%2F+NOT+path%3A%2Ffe-cancel.c%24%2F+NOT+path%3A%2Flibpq-fe.h%24%2F+NOT+path%3A%2Fbindings%5Cw*.rs%24%2F+NOT+path%3A%2Flibpq2.sgml%24%2F+NOT+path%3A%2Fexports.txt%24%2F+NOT+path%3A%2Ffe-connect.c%24%2F++NOT+path%3A%2F_pq_ctypes.pyi%24%2F+NOT+path%3A%2F%5Esrc%5C%2Finclude%5C%2Flibpq%5C%2F%2F+NOT+path%3A%2F%5Esrc%5C%2Ffe_utils%5C%2F%2F+NOT+path%3A%2F%5C%2Ftest%5C%2Fisolation%5C%2F%2F+NOT+path%3A%2F%5C%2Ftest%5C%2Fmodules%5C%2Flibpq_pipeline%5C%2F%2F&type=code&p=2



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: BackendKeyData is mandatory?
Next
From: Sami Imseih
Date:
Subject: Re: track generic and custom plans in pg_stat_statements