Add pg_ls_tmpdir function

Enterprise / PostgreSQL - Michael Paquier [] - 5 October 2018 00:21 EDT

This lists the contents of a temporary directory associated to a given tablespace, useful to get information about on-disk consumption caused by temporary files used by a session query. By default, pg_default is scanned, and a tablespace can be specified as argument.

This function is intended to be used by monitoring tools, and, unlike pg_ls_dir(), access to them can be granted to non-superusers so that those monitoring tools can observe the principle of least privilege. Access is also given by default to members of pg_monitor.

Author: Nathan Bossart

9cd92d1a33 Add pg_ls_tmpdir function
doc/src/sgml/func.sgml | 27 ++++++++++++++++
src/backend/catalog/system_views.sql | 4 +++
src/backend/utils/adt/genfile.c | 62 ++++++++++++++++++++++++++++++++----
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 10 ++++++
5 files changed, 97 insertions(+), 8 deletions(-)


  • Share