diff options
| author | Nathan Bossart | 2024-10-11 16:02:09 +0000 |
|---|---|---|
| committer | Nathan Bossart | 2024-10-11 16:02:09 +0000 |
| commit | 4e1fad37872e49a711adad5d9870516e5c71a375 (patch) | |
| tree | b22f685d15c9a28aa22328f769d6b5c5bef61319 /src/backend | |
| parent | add77755ce851fae2f72be4b9c56a606f9362895 (diff) | |
Add pg_ls_summariesdir().
This function returns the name, size, and last modification time of
each regular file in pg_wal/summaries. This allows administrators
to grant privileges to view the contents of this directory without
granting privileges on pg_ls_dir(), which allows listing the
contents of many other directories. This commit also gives the
pg_monitor predefined role EXECUTE privileges on the new
pg_ls_summariesdir() function.
Bumps catversion.
Author: Yushi Ogiwara
Reviewed-by: Michael Paquier, Fujii Masao
Discussion: https://postgr.es/m/a0a3af15a9b9daa107739eb45aa9a9bc%40oss.nttdata.com
Diffstat (limited to 'src/backend')
| -rw-r--r-- | src/backend/catalog/system_functions.sql | 4 | ||||
| -rw-r--r-- | src/backend/utils/adt/genfile.c | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/backend/catalog/system_functions.sql b/src/backend/catalog/system_functions.sql index b0d0de051e7..fd6b606ae90 100644 --- a/src/backend/catalog/system_functions.sql +++ b/src/backend/catalog/system_functions.sql @@ -700,6 +700,8 @@ REVOKE EXECUTE ON FUNCTION pg_ls_waldir() FROM public; REVOKE EXECUTE ON FUNCTION pg_ls_archive_statusdir() FROM public; +REVOKE EXECUTE ON FUNCTION pg_ls_summariesdir() FROM public; + REVOKE EXECUTE ON FUNCTION pg_ls_tmpdir() FROM public; REVOKE EXECUTE ON FUNCTION pg_ls_tmpdir(oid) FROM public; @@ -770,6 +772,8 @@ GRANT EXECUTE ON FUNCTION pg_ls_waldir() TO pg_monitor; GRANT EXECUTE ON FUNCTION pg_ls_archive_statusdir() TO pg_monitor; +GRANT EXECUTE ON FUNCTION pg_ls_summariesdir() TO pg_monitor; + GRANT EXECUTE ON FUNCTION pg_ls_tmpdir() TO pg_monitor; GRANT EXECUTE ON FUNCTION pg_ls_tmpdir(oid) TO pg_monitor; diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c index 24b95c32b78..91d0bb46309 100644 --- a/src/backend/utils/adt/genfile.c +++ b/src/backend/utils/adt/genfile.c @@ -690,6 +690,15 @@ pg_ls_archive_statusdir(PG_FUNCTION_ARGS) } /* + * Function to return the list of files in the WAL summaries directory. + */ +Datum +pg_ls_summariesdir(PG_FUNCTION_ARGS) +{ + return pg_ls_dir_files(fcinfo, XLOGDIR "/summaries", true); +} + +/* * Function to return the list of files in the PG_LOGICAL_SNAPSHOTS_DIR * directory. */ |
