| From: | Nathan Bossart <nathan(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Retire PQfn(). |
| Date: | 2026-08-14 16:30:43 |
| Message-ID: | E1wuunq-00000000ZIw-1aCF@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Retire PQfn().
PQfn() has been documented as somewhat obsolete since commit
efc3a25bb0 (2003), and commit bd48114937 recently marked it unsafe
because it may write past the end of result_buf when result_is_int
is 0. Furthermore, searches of publicly available code turned up
no callers, only language bindings that expose the function
without using it, so removing it seems unlikely to cause too much
trouble.
Since the symbol is exported, deleting it outright isn't an option,
so instead this commit teaches PQfn() to fail unconditionally with
an error that suggests alternatives. The documentation for the
fast-path interface is replaced with a stub in the "Obsolete or
Renamed Features" appendix. The server's fast-path support is
retained for the benefit of older clients and the frontend large
object interface.
The frontend large object interface, the only in-tree caller, now
uses PQnfn(), the private version of PQfn() added by commit
bd48114937. I considered converting this code away from the
fast-path protocol entirely, but prepared statements can be
deallocated out from under libpq (e.g., by DISCARD ALL), and
PQexecParams() proved noticeably slower, so that is left as a
future exercise.
Reviewed-by: Christoph Berg <myon(at)debian(dot)org>
Reviewed-by: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Discussion: https://postgr.es/m/ahXE28klgxIJXBLq%40nathan
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/40af05bb6157670482ae31fd5b0a12ff2992c966
Modified Files
--------------
doc/src/sgml/appendix-obsolete-libpq-fastpath.sgml | 30 ++++++
doc/src/sgml/appendix-obsolete.sgml | 1 +
doc/src/sgml/filelist.sgml | 1 +
doc/src/sgml/libpq.sgml | 117 +--------------------
src/backend/tcop/fastpath.c | 4 +-
src/include/tcop/dest.h | 4 +-
src/interfaces/libpq/fe-exec.c | 55 ++++++++--
src/interfaces/libpq/fe-lobj.c | 38 +++----
src/interfaces/libpq/fe-protocol3.c | 6 +-
src/interfaces/libpq/libpq-fe.h | 3 +-
10 files changed, 107 insertions(+), 152 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nathan Bossart | 2026-08-14 18:42:22 | pgsql: Add missing PGDLLIMPORT marker. |
| Previous Message | Tom Lane | 2026-08-14 16:14:43 | pgsql: psql: count every COPY FROM STDIN when scanning a query string. |