]> git.ipfire.org Git - thirdparty/postgresql.git/commit
libpq: Add support for Close on portals and statements
authorMichael Paquier <michael@paquier.xyz>
Tue, 4 Jul 2023 05:48:10 +0000 (14:48 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 4 Jul 2023 05:48:10 +0000 (14:48 +0900)
commit28b5726561841556dc3e00ffe26b01a8107ee654
tree79a4dad5f2ebae14b3ed650b367a79d7a1f23964
parent03f80daac8cff257294108caf908fe0397c40e1a
libpq: Add support for Close on portals and statements

The following routines are added to libpq:
PGresult *PQclosePrepared(PGconn *conn, const char *stmt);
PGresult *PQclosePortal(PGconn *conn, const char *portal);
int PQsendClosePrepared(PGconn *conn, const char *stmt);
int PQsendClosePortal(PGconn *conn, const char *portal);

The "send" routines are non-blocking versions of the two others.

Close messages are part of the protocol but they did not have a libpq
implementation.  And, having these routines is for instance useful with
connection poolers as these can detect more easily Close messages
than DEALLOCATE queries.

The implementation takes advantage of what the Describe routines rely on
for portals and statements.  Some regression tests are added in
libpq_pipeline, for the four new routines, by closing portals and
statements created already by the tests.

Author: Jelte Fennema
Reviewed-by: Jian He, Michael Paquier
Discussion: https://postgr.es/m/CAGECzQTb4xFAopAVokudB+L62Kt44mNAL4Z9zZ7UTrs1TRFvWA@mail.gmail.com
doc/src/sgml/libpq.sgml
src/interfaces/libpq/exports.txt
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-protocol3.c
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-int.h
src/test/modules/libpq_pipeline/libpq_pipeline.c
src/test/modules/libpq_pipeline/traces/prepared.trace