diff options
author | Michael Paquier <michael@paquier.xyz> | 2018-10-09 22:29:09 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2018-10-09 22:29:09 +0900 |
commit | c48101620151f78ee184e5f81766cbac347d9a11 (patch) | |
tree | 86396a88627f0de5bcd0052dcde7dea3af5e748d /src/backend/utils/adt/genfile.c | |
parent | bfa6c5a0c974b14601b689efa4e52f6a372aee0c (diff) |
Add pg_ls_archive_statusdir function
This function lists the contents of the WAL archive status directory,
and is intended to be used by monitoring tools. Unlike pg_ls_dir(),
access to it 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: Christoph Moench-Tegeder
Reviewed-by: Aya Iwata
Discussion: https://postgr.es/m/20180930205920.GA64534@elch.exwg.net
Diffstat (limited to 'src/backend/utils/adt/genfile.c')
-rw-r--r-- | src/backend/utils/adt/genfile.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c index 85bea8d5022..d4dc92c2fd9 100644 --- a/src/backend/utils/adt/genfile.c +++ b/src/backend/utils/adt/genfile.c @@ -658,3 +658,12 @@ pg_ls_tmpdir_1arg(PG_FUNCTION_ARGS) { return pg_ls_tmpdir(fcinfo, PG_GETARG_OID(0)); } + +/* + * Function to return the list of files in the WAL archive status directory. + */ +Datum +pg_ls_archive_statusdir(PG_FUNCTION_ARGS) +{ + return pg_ls_dir_files(fcinfo, XLOGDIR "/archive_status", true); +} |