PG-293: Update regression tests (extract_comments).

guc: Add the new GUC variable to the output.

tags: Handle both cases, enable/disable extracting query comments.
pull/157/head
Diego Fronza 2021-12-09 15:56:35 -03:00
parent 6042795930
commit a702f24465
4 changed files with 52 additions and 2 deletions

View File

@ -14,6 +14,7 @@ select pg_sleep(.5);
SELECT * FROM pg_stat_monitor_settings ORDER BY name COLLATE "C";
name | value | default_value | description | minimum | maximum | options | restart
------------------------------------------+--------+---------------+----------------------------------------------------------------------------------------------------------+---------+------------+----------------+---------
pg_stat_monitor.extract_comments | no | no | Enable/Disable extracting comments from queries. | | | yes, no | no
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_enable_query_plan | no | no | Enable/Disable query plan monitoring | | | yes, no | no
pg_stat_monitor.pgsm_histogram_buckets | 10 | 10 | Sets the maximum number of histogram buckets | 2 | 2147483647 | | yes
@ -28,7 +29,7 @@ SELECT * FROM pg_stat_monitor_settings ORDER BY name COLLATE "C";
pg_stat_monitor.pgsm_track_planning | yes | yes | Selects whether planning statistics are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.track | top | top | Selects which statements are tracked by pg_stat_monitor. | | | none, top, all | no
(14 rows)
(15 rows)
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset

View File

@ -14,6 +14,7 @@ select pg_sleep(.5);
SELECT * FROM pg_stat_monitor_settings ORDER BY name COLLATE "C";
name | value | default_value | description | minimum | maximum | options | restart
------------------------------------------+--------+---------------+----------------------------------------------------------------------------------------------------------+---------+------------+----------------+---------
pg_stat_monitor.extract_comments | no | no | Enable/Disable extracting comments from queries. | | | yes, no | no
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_enable_query_plan | no | no | Enable/Disable query plan monitoring | | | yes, no | no
pg_stat_monitor.pgsm_histogram_buckets | 10 | 10 | Sets the maximum number of histogram buckets | 2 | 2147483647 | | yes
@ -27,7 +28,7 @@ SELECT * FROM pg_stat_monitor_settings ORDER BY name COLLATE "C";
pg_stat_monitor.pgsm_query_shared_buffer | 20 | 20 | Sets the maximum size of shared memory in (MB) used for query tracked by pg_stat_monitor. | 1 | 10000 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.track | top | top | Selects which statements are tracked by pg_stat_monitor. | | | none, top, all | no
(13 rows)
(14 rows)
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset

View File

@ -11,6 +11,39 @@ SELECT 1 AS num /* { "application", psql_app, "real_ip", 192.168.1.3) */;
1
(1 row)
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | comments
---------------------------------------------------------------------------+----------
SELECT $1 AS num /* { "application", psql_app, "real_ip", 192.168.1.3) */ |
SELECT pg_stat_monitor_reset() |
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C" |
(3 rows)
ALTER SYSTEM SET pg_stat_monitor.extract_comments TO 'yes';
SELECT pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)
select pg_sleep(1);
pg_sleep
----------
(1 row)
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset
-----------------------
(1 row)
SELECT 1 AS num /* { "application", psql_app, "real_ip", 192.168.1.3) */;
num
-----
1
(1 row)
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | comments
---------------------------------------------------------------------------+----------------------------------------------------------
@ -19,6 +52,13 @@ SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C";
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C" |
(3 rows)
ALTER SYSTEM SET pg_stat_monitor.extract_comments TO 'no';
SELECT pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset
-----------------------

View File

@ -2,5 +2,13 @@ CREATE EXTENSION pg_stat_monitor;
SELECT pg_stat_monitor_reset();
SELECT 1 AS num /* { "application", psql_app, "real_ip", 192.168.1.3) */;
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C";
ALTER SYSTEM SET pg_stat_monitor.extract_comments TO 'yes';
SELECT pg_reload_conf();
select pg_sleep(1);
SELECT pg_stat_monitor_reset();
SELECT 1 AS num /* { "application", psql_app, "real_ip", 192.168.1.3) */;
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C";
ALTER SYSTEM SET pg_stat_monitor.extract_comments TO 'no';
SELECT pg_reload_conf();
SELECT pg_stat_monitor_reset();
DROP EXTENSION pg_stat_monitor;