From 1037fb08a8586a6093ddfa6c793b4cd70f67599b Mon Sep 17 00:00:00 2001 From: Naeem Akhter Date: Mon, 12 Dec 2022 15:41:09 +0500 Subject: [PATCH] PG-558: Create test case to verify the function names and count in PGSM. --- Makefile | 2 +- regression/expected/functions.out | 41 +++++++++++++++++++++++++++++++ regression/sql/functions.sql | 15 +++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 regression/expected/functions.out create mode 100644 regression/sql/functions.sql diff --git a/Makefile b/Makefile index 2a1e11a..471988c 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ LDFLAGS_SL += $(filter -lm, $(LIBS)) TAP_TESTS = 1 REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/pg_stat_monitor/pg_stat_monitor.conf --inputdir=regression -REGRESS = basic version guc counters relations database error_insert application_name application_name_unique top_query cmd_type error rows tags +REGRESS = basic version guc functions counters relations database error_insert application_name application_name_unique top_query cmd_type error rows tags # Disabled because these tests require "shared_preload_libraries=pg_stat_statements", # which typical installcheck users do not have (e.g. buildfarm clients). diff --git a/regression/expected/functions.out b/regression/expected/functions.out new file mode 100644 index 0000000..2e94b48 --- /dev/null +++ b/regression/expected/functions.out @@ -0,0 +1,41 @@ +CREATE USER su WITH SUPERUSER; +SET ROLE su; +CREATE EXTENSION pg_stat_monitor; +CREATE USER u1; +SELECT pg_stat_monitor_reset(); + pg_stat_monitor_reset +----------------------- + +(1 row) + +SELECT routine_schema, routine_name, routine_type, data_type FROM information_schema.routines WHERE routine_schema = 'public' ORDER BY routine_name COLLATE "C"; + routine_schema | routine_name | routine_type | data_type +----------------+--------------------------+--------------+----------- + public | decode_error_level | FUNCTION | text + public | get_cmd_type | FUNCTION | text + public | get_histogram_timings | FUNCTION | text + public | histogram | FUNCTION | record + public | pg_stat_monitor_internal | FUNCTION | record + public | pg_stat_monitor_reset | FUNCTION | void + public | pg_stat_monitor_settings | FUNCTION | record + public | pg_stat_monitor_version | FUNCTION | text + public | pgsm_create_11_view | FUNCTION | integer + public | pgsm_create_13_view | FUNCTION | integer + public | pgsm_create_14_view | FUNCTION | integer + public | pgsm_create_15_view | FUNCTION | integer + public | pgsm_create_view | FUNCTION | integer + public | range | FUNCTION | ARRAY +(14 rows) + +SET ROLE u1; +SELECT routine_schema, routine_name, routine_type, data_type FROM information_schema.routines WHERE routine_schema = 'public' ORDER BY routine_name COLLATE "C"; + routine_schema | routine_name | routine_type | data_type +----------------+-------------------------+--------------+----------- + public | histogram | FUNCTION | record + public | pg_stat_monitor_reset | FUNCTION | void + public | pg_stat_monitor_version | FUNCTION | text +(3 rows) + +set role su; +DROP USER u1; +DROP EXTENSION pg_stat_monitor; diff --git a/regression/sql/functions.sql b/regression/sql/functions.sql new file mode 100644 index 0000000..27db119 --- /dev/null +++ b/regression/sql/functions.sql @@ -0,0 +1,15 @@ +CREATE USER su WITH SUPERUSER; +SET ROLE su; + +CREATE EXTENSION pg_stat_monitor; +CREATE USER u1; + +SELECT pg_stat_monitor_reset(); +SELECT routine_schema, routine_name, routine_type, data_type FROM information_schema.routines WHERE routine_schema = 'public' ORDER BY routine_name COLLATE "C"; + +SET ROLE u1; +SELECT routine_schema, routine_name, routine_type, data_type FROM information_schema.routines WHERE routine_schema = 'public' ORDER BY routine_name COLLATE "C"; + +set role su; +DROP USER u1; +DROP EXTENSION pg_stat_monitor;