Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8d8afd4

Browse files
Allow pg_monitor to execute pg_current_logfile().
We allow roles with privileges of pg_monitor to execute functionslike pg_ls_logdir(), so it seems natural that such roles would alsobe able to execute this function.Bumps catversion.Co-authored-by: Pavlo GolubReviewed-by: Daniel GustafssonDiscussion:https://postgr.es/m/CAK7ymcLmEYWyQkiCZ64WC-HCzXAB0omM%3DYpj9B3rXe8vUAFMqw%40mail.gmail.com
1 parent3e8235b commit8d8afd4

File tree

5 files changed

+41
-1
lines changed

5 files changed

+41
-1
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23735,6 +23735,11 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
2373523735
<xref linkend="guc-log-destination"/>.
2373623736
The result reflects the contents of
2373723737
the <filename>current_logfiles</filename> file.
23738+
</para>
23739+
<para>
23740+
This function is restricted to superusers and roles with privileges of
23741+
the <literal>pg_monitor</literal> role by default, but other users can
23742+
be granted EXECUTE to run the function.
2373823743
</para></entry>
2373923744
</row>
2374023745

‎src/backend/catalog/system_functions.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,10 @@ GRANT EXECUTE ON FUNCTION pg_ls_logicalmapdir() TO pg_monitor;
777777

778778
GRANT EXECUTEON FUNCTION pg_ls_replslotdir(text) TO pg_monitor;
779779

780+
GRANT EXECUTEON FUNCTION pg_current_logfile() TO pg_monitor;
781+
782+
GRANT EXECUTEON FUNCTION pg_current_logfile(text) TO pg_monitor;
783+
780784
GRANT pg_read_all_settings TO pg_monitor;
781785

782786
GRANT pg_read_all_stats TO pg_monitor;

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
*/
5858

5959
/*yyyymmddN */
60-
#defineCATALOG_VERSION_NO202402141
60+
#defineCATALOG_VERSION_NO202402142
6161

6262
#endif

‎src/test/regress/expected/misc_functions.out

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,3 +683,23 @@ SELECT gist_stratnum_identity(18::smallint);
683683
18
684684
(1 row)
685685

686+
-- pg_current_logfile
687+
CREATE ROLE regress_current_logfile;
688+
-- not available by default
689+
SELECT has_function_privilege('regress_current_logfile',
690+
'pg_current_logfile()', 'EXECUTE');
691+
has_function_privilege
692+
------------------------
693+
f
694+
(1 row)
695+
696+
GRANT pg_monitor TO regress_current_logfile;
697+
-- role has privileges of pg_monitor and can execute the function
698+
SELECT has_function_privilege('regress_current_logfile',
699+
'pg_current_logfile()', 'EXECUTE');
700+
has_function_privilege
701+
------------------------
702+
t
703+
(1 row)
704+
705+
DROP ROLE regress_current_logfile;

‎src/test/regress/sql/misc_functions.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,14 @@ FROM pg_walfile_name_offset('0/0'::pg_lsn + :segment_size - 1),
254254
-- test stratnum support functions
255255
SELECT gist_stratnum_identity(3::smallint);
256256
SELECT gist_stratnum_identity(18::smallint);
257+
258+
-- pg_current_logfile
259+
CREATE ROLE regress_current_logfile;
260+
-- not available by default
261+
SELECT has_function_privilege('regress_current_logfile',
262+
'pg_current_logfile()','EXECUTE');
263+
GRANT pg_monitor TO regress_current_logfile;
264+
-- role has privileges of pg_monitor and can execute the function
265+
SELECT has_function_privilege('regress_current_logfile',
266+
'pg_current_logfile()','EXECUTE');
267+
DROP ROLE regress_current_logfile;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp