pgsql: Avoid holding a directory FD open across assorted SRF calls.

Started by Tom Laneover 6 years ago1 messagescomitters
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

Avoid holding a directory FD open across assorted SRF calls.

This extends the fixes made in commit 085b6b667 to other SRFs with the
same bug, namely pg_logdir_ls(), pgrowlocks(), pg_timezone_names(),
pg_ls_dir(), and pg_tablespace_databases().

Also adjust various comments and documentation to warn against
expecting to clean up resources during a ValuePerCall SRF's final
call.

Back-patch to all supported branches, since these functions were
all born broken.

Justin Pryzby, with cosmetic tweaks by me

Discussion: /messages/by-id/20200308173103.GC1357@telsasoft.com

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cd6a0518794d939ed6a716c1a13ead2900b11d50

Modified Files
--------------
contrib/adminpack/adminpack.c | 80 ++++++++---------
contrib/pgrowlocks/pgrowlocks.c | 124 +++++++++++---------------
doc/src/sgml/xfunc.sgml | 98 +++++++++++++--------
src/backend/utils/adt/datetime.c | 101 +++++++++------------
src/backend/utils/adt/genfile.c | 105 +++++++++++-----------
src/backend/utils/adt/misc.c | 127 +++++++++++++++------------
src/backend/utils/fmgr/README | 16 ++--
src/include/funcapi.h | 13 ++-
src/test/regress/expected/misc_functions.out | 27 ++++++
src/test/regress/sql/misc_functions.sql | 15 ++++
10 files changed, 382 insertions(+), 324 deletions(-)