Re: Deleting prepared statements from libpq. - Mailing list pgsql-hackers

From Jelte Fennema
Subject Re: Deleting prepared statements from libpq.
Date
Msg-id CAGECzQTb4xFAopAVokudB+L62Kt44mNAL4Z9zZ7UTrs1TRFvWA@mail.gmail.com
Whole thread Raw
In response to Re: Deleting prepared statements from libpq.  (Craig Ringer <craig@2ndquadrant.com>)
Responses Re: Deleting prepared statements from libpq.
List pgsql-hackers
On Fri, 16 Jun 2023 at 16:26, Craig Ringer <craig@2ndquadrant.com> wrote:
> Nobody's implemented it.
>
> A patch to add PQclosePrepared and PQsendClosePrepared would be welcome. At least, I think so...

This might have been a pretty old thread. But I just took it upon me
to implement these functions (or well I mostly copied the
PQsendDescribe related code and did s/describe/close). I haven't
tested this code yet but I'm pretty sure it should just work (it
compiles at least).

The main reason I'm interested in this is because we're actively
working on implementing named prepared statement support for PgBouncer
in transaction pooling mode. It works with lots of client libraries
already. But sadly it doesn't work with psycopg at the moment, or at
least the closing part does not. And the reason is that psycopg closes
statements using a DEALLOCATE query instead of the Close protocol
message, because libpq does not support sending the Close protocol
message.

Afaict this is not just a problem for PgBouncer its implementation. As
far as I can tell the same is true for the Odyssey connection pooler
(which implemented named prepared statement support first).

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Order changes in PG16 since ICU introduction
Next
From: Tomas Vondra
Date:
Subject: Re: Incorrect estimation of HashJoin rows resulted from inaccurate small table statistics