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 <[email protected]>
Reviewed-by: Jacob Champion <[email protected]>
Reviewed-by: Dagfinn Ilmari MannsÃ¥ker <[email protected]>
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(-)

Reply via email to