PG-293: Update regression tests.
cmd_type: Added missing DROP TABLE t2; guc: Adjusted to match the updated settings view, which now display boolean values as 'yes' and 'no', also added the 'options' column to the output. guc_1: Handle PostgreSQL versions <= 12 which don't have the track_planning feature. rows.out: Added missing DROP TABLE t2. Also removed the line 'ERROR: relation "t2" already exists' since we fixed the problem in cmd_type regression. top_query: Handling both track = 'top' and track = 'all' cases. top_query_1: On PostgreSQL >= 14 the sub query from the procedure is stored as (select $1 + $2), whereas on PG <= 13 it is stored as SELECT (select $1 + $2).pull/157/head
parent
b6838049b6
commit
30a328f381
|
@ -23,6 +23,7 @@ SELECT b FROM t2 FOR UPDATE;
|
|||
|
||||
TRUNCATE t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
SELECT query, cmd_type, cmd_type_text FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||
query | cmd_type | cmd_type_text
|
||||
----------------------------------------------------------------------------------------+----------+---------------
|
||||
|
@ -30,6 +31,7 @@ SELECT query, cmd_type, cmd_type_text FROM pg_stat_monitor ORDER BY query COLLA
|
|||
CREATE TABLE t2 (b INTEGER) | 0 |
|
||||
DELETE FROM t1 | 4 | DELETE
|
||||
DROP TABLE t1 | 0 |
|
||||
DROP TABLE t2 | 0 |
|
||||
INSERT INTO t1 VALUES($1) | 3 | INSERT
|
||||
SELECT a FROM t1 | 1 | SELECT
|
||||
SELECT b FROM t2 FOR UPDATE | 1 | SELECT
|
||||
|
@ -37,7 +39,7 @@ SELECT query, cmd_type, cmd_type_text FROM pg_stat_monitor ORDER BY query COLLA
|
|||
SELECT query, cmd_type, cmd_type_text FROM pg_stat_monitor ORDER BY query COLLATE "C" | 1 | SELECT
|
||||
TRUNCATE t1 | 0 |
|
||||
UPDATE t1 SET a = $1 | 2 | UPDATE
|
||||
(11 rows)
|
||||
(12 rows)
|
||||
|
||||
SELECT pg_stat_monitor_reset();
|
||||
pg_stat_monitor_reset
|
||||
|
|
|
@ -12,22 +12,22 @@ select pg_sleep(.5);
|
|||
(1 row)
|
||||
|
||||
SELECT * FROM pg_stat_monitor_settings ORDER BY name COLLATE "C";
|
||||
name | value | default_value | description | minimum | maximum | restart
|
||||
------------------------------------------+--------+---------------+----------------------------------------------------------------------------------------------------------+---------+------------+---------
|
||||
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | 1
|
||||
pg_stat_monitor.pgsm_enable | 1 | 1 | Enable/Disable statistics collector. | 0 | 0 | 0
|
||||
pg_stat_monitor.pgsm_enable_query_plan | 0 | 0 | Enable/Disable query plan monitoring | 0 | 0 | 0
|
||||
pg_stat_monitor.pgsm_histogram_buckets | 10 | 10 | Sets the maximum number of histogram buckets | 2 | 2147483647 | 1
|
||||
pg_stat_monitor.pgsm_histogram_max | 100000 | 100000 | Sets the time in millisecond. | 10 | 2147483647 | 1
|
||||
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | 1
|
||||
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | 1
|
||||
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | 1
|
||||
pg_stat_monitor.pgsm_normalized_query | 1 | 1 | Selects whether save query in normalized format. | 0 | 0 | 0
|
||||
pg_stat_monitor.pgsm_overflow_target | 1 | 1 | Sets the overflow target for pg_stat_monitor | 0 | 1 | 1
|
||||
pg_stat_monitor.pgsm_query_max_len | 1024 | 1024 | Sets the maximum length of query. | 1024 | 2147483647 | 1
|
||||
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 | 1
|
||||
pg_stat_monitor.pgsm_track_planning | 1 | 1 | Selects whether planning statistics are tracked. | 0 | 0 | 0
|
||||
pg_stat_monitor.pgsm_track_utility | 1 | 1 | Selects whether utility commands are tracked. | 0 | 0 | 0
|
||||
name | value | default_value | description | minimum | maximum | options | restart
|
||||
------------------------------------------+--------+---------------+----------------------------------------------------------------------------------------------------------+---------+------------+----------------+---------
|
||||
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
|
||||
pg_stat_monitor.pgsm_histogram_max | 100000 | 100000 | Sets the time in millisecond. | 10 | 2147483647 | | yes
|
||||
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
|
||||
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
|
||||
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
|
||||
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
|
||||
pg_stat_monitor.pgsm_overflow_target | 1 | 1 | Sets the overflow target for pg_stat_monitor | 0 | 1 | | yes
|
||||
pg_stat_monitor.pgsm_query_max_len | 1024 | 1024 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
|
||||
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_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)
|
||||
|
||||
SELECT pg_stat_monitor_reset();
|
||||
|
|
|
@ -12,21 +12,21 @@ select pg_sleep(.5);
|
|||
(1 row)
|
||||
|
||||
SELECT * FROM pg_stat_monitor_settings ORDER BY name COLLATE "C";
|
||||
name | value | default_value | description | minimum | maximum | restart
|
||||
------------------------------------------+--------+---------------+----------------------------------------------------------------------------------------------------------+---------+------------+---------
|
||||
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | 1
|
||||
pg_stat_monitor.pgsm_enable | 1 | 1 | Enable/Disable statistics collector. | 0 | 0 | 0
|
||||
pg_stat_monitor.pgsm_enable_query_plan | 0 | 0 | Enable/Disable query plan monitoring | 0 | 0 | 0
|
||||
pg_stat_monitor.pgsm_histogram_buckets | 10 | 10 | Sets the maximum number of histogram buckets | 2 | 2147483647 | 1
|
||||
pg_stat_monitor.pgsm_histogram_max | 100000 | 100000 | Sets the time in millisecond. | 10 | 2147483647 | 1
|
||||
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | 1
|
||||
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | 1
|
||||
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | 1
|
||||
pg_stat_monitor.pgsm_normalized_query | 1 | 1 | Selects whether save query in normalized format. | 0 | 0 | 0
|
||||
pg_stat_monitor.pgsm_overflow_target | 1 | 1 | Sets the overflow target for pg_stat_monitor | 0 | 1 | 1
|
||||
pg_stat_monitor.pgsm_query_max_len | 1024 | 1024 | Sets the maximum length of query. | 1024 | 2147483647 | 1
|
||||
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 | 1
|
||||
pg_stat_monitor.pgsm_track_utility | 1 | 1 | Selects whether utility commands are tracked. | 0 | 0 | 0
|
||||
name | value | default_value | description | minimum | maximum | options | restart
|
||||
------------------------------------------+--------+---------------+----------------------------------------------------------------------------------------------------------+---------+------------+----------------+---------
|
||||
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
|
||||
pg_stat_monitor.pgsm_histogram_max | 100000 | 100000 | Sets the time in millisecond. | 10 | 2147483647 | | yes
|
||||
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
|
||||
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
|
||||
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
|
||||
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
|
||||
pg_stat_monitor.pgsm_overflow_target | 1 | 1 | Sets the overflow target for pg_stat_monitor | 0 | 1 | | yes
|
||||
pg_stat_monitor.pgsm_query_max_len | 1024 | 1024 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
|
||||
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)
|
||||
|
||||
SELECT pg_stat_monitor_reset();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
CREATE EXTENSION pg_stat_monitor;
|
||||
CREATE TABLE t1(a int);
|
||||
CREATE TABLE t2(b int);
|
||||
ERROR: relation "t2" already exists
|
||||
INSERT INTO t1 VALUES(generate_series(1,1000));
|
||||
INSERT INTO t2 VALUES(generate_series(1,5000));
|
||||
SELECT pg_stat_monitor_reset();
|
||||
|
@ -8558,4 +8557,5 @@ SELECT pg_stat_monitor_reset();
|
|||
(1 row)
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP EXTENSION pg_stat_monitor;
|
||||
|
|
|
@ -22,6 +22,55 @@ SELECT add2(1,2);
|
|||
3
|
||||
(1 row)
|
||||
|
||||
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||
query | top_query
|
||||
-------------------------------------------------------------------------+-----------
|
||||
CREATE OR REPLACE FUNCTION add(int, int) RETURNS INTEGER AS +|
|
||||
$$ +|
|
||||
BEGIN +|
|
||||
return (select $1 + $2); +|
|
||||
END; $$ language plpgsql |
|
||||
CREATE OR REPLACE function add2(int, int) RETURNS int as +|
|
||||
$$ +|
|
||||
BEGIN +|
|
||||
return add($1,$2); +|
|
||||
END; +|
|
||||
$$ language plpgsql |
|
||||
SELECT add2($1,$2) |
|
||||
SELECT pg_stat_monitor_reset() |
|
||||
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C" |
|
||||
(5 rows)
|
||||
|
||||
ALTER SYSTEM SET pg_stat_monitor.track TO 'all';
|
||||
SELECT pg_reload_conf();
|
||||
pg_reload_conf
|
||||
----------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT pg_stat_monitor_reset();
|
||||
pg_stat_monitor_reset
|
||||
-----------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
CREATE OR REPLACE FUNCTION add(int, int) RETURNS INTEGER AS
|
||||
$$
|
||||
BEGIN
|
||||
return (select $1 + $2);
|
||||
END; $$ language plpgsql;
|
||||
CREATE OR REPLACE function add2(int, int) RETURNS int as
|
||||
$$
|
||||
BEGIN
|
||||
return add($1,$2);
|
||||
END;
|
||||
$$ language plpgsql;
|
||||
SELECT add2(1,2);
|
||||
add2
|
||||
------
|
||||
3
|
||||
(1 row)
|
||||
|
||||
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||
query | top_query
|
||||
-------------------------------------------------------------------------+--------------------
|
||||
|
@ -42,6 +91,13 @@ SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
|||
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C" |
|
||||
(6 rows)
|
||||
|
||||
ALTER SYSTEM SET pg_stat_monitor.track TO 'top';
|
||||
SELECT pg_reload_conf();
|
||||
pg_reload_conf
|
||||
----------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT pg_stat_monitor_reset();
|
||||
pg_stat_monitor_reset
|
||||
-----------------------
|
||||
|
|
|
@ -22,6 +22,55 @@ SELECT add2(1,2);
|
|||
3
|
||||
(1 row)
|
||||
|
||||
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||
query | top_query
|
||||
-------------------------------------------------------------------------+-----------
|
||||
CREATE OR REPLACE FUNCTION add(int, int) RETURNS INTEGER AS +|
|
||||
$$ +|
|
||||
BEGIN +|
|
||||
return (select $1 + $2); +|
|
||||
END; $$ language plpgsql |
|
||||
CREATE OR REPLACE function add2(int, int) RETURNS int as +|
|
||||
$$ +|
|
||||
BEGIN +|
|
||||
return add($1,$2); +|
|
||||
END; +|
|
||||
$$ language plpgsql |
|
||||
SELECT add2($1,$2) |
|
||||
SELECT pg_stat_monitor_reset() |
|
||||
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C" |
|
||||
(5 rows)
|
||||
|
||||
ALTER SYSTEM SET pg_stat_monitor.track TO 'all';
|
||||
SELECT pg_reload_conf();
|
||||
pg_reload_conf
|
||||
----------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT pg_stat_monitor_reset();
|
||||
pg_stat_monitor_reset
|
||||
-----------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
CREATE OR REPLACE FUNCTION add(int, int) RETURNS INTEGER AS
|
||||
$$
|
||||
BEGIN
|
||||
return (select $1 + $2);
|
||||
END; $$ language plpgsql;
|
||||
CREATE OR REPLACE function add2(int, int) RETURNS int as
|
||||
$$
|
||||
BEGIN
|
||||
return add($1,$2);
|
||||
END;
|
||||
$$ language plpgsql;
|
||||
SELECT add2(1,2);
|
||||
add2
|
||||
------
|
||||
3
|
||||
(1 row)
|
||||
|
||||
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||
query | top_query
|
||||
-------------------------------------------------------------------------+--------------------
|
||||
|
@ -42,6 +91,13 @@ SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
|||
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C" |
|
||||
(6 rows)
|
||||
|
||||
ALTER SYSTEM SET pg_stat_monitor.track TO 'top';
|
||||
SELECT pg_reload_conf();
|
||||
pg_reload_conf
|
||||
----------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT pg_stat_monitor_reset();
|
||||
pg_stat_monitor_reset
|
||||
-----------------------
|
||||
|
|
|
@ -10,6 +10,7 @@ DELETE FROM t1;
|
|||
SELECT b FROM t2 FOR UPDATE;
|
||||
TRUNCATE t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
SELECT query, cmd_type, cmd_type_text FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||
SELECT pg_stat_monitor_reset();
|
||||
|
||||
|
|
|
@ -16,4 +16,5 @@ SELECT query, rows_retrieved FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
|||
SELECT pg_stat_monitor_reset();
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP EXTENSION pg_stat_monitor;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
CREATE EXTENSION pg_stat_monitor;
|
||||
SELECT pg_stat_monitor_reset();
|
||||
|
||||
CREATE OR REPLACE FUNCTION add(int, int) RETURNS INTEGER AS
|
||||
$$
|
||||
BEGIN
|
||||
|
@ -15,5 +16,28 @@ $$ language plpgsql;
|
|||
|
||||
SELECT add2(1,2);
|
||||
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||
|
||||
ALTER SYSTEM SET pg_stat_monitor.track TO 'all';
|
||||
SELECT pg_reload_conf();
|
||||
SELECT pg_stat_monitor_reset();
|
||||
|
||||
CREATE OR REPLACE FUNCTION add(int, int) RETURNS INTEGER AS
|
||||
$$
|
||||
BEGIN
|
||||
return (select $1 + $2);
|
||||
END; $$ language plpgsql;
|
||||
|
||||
CREATE OR REPLACE function add2(int, int) RETURNS int as
|
||||
$$
|
||||
BEGIN
|
||||
return add($1,$2);
|
||||
END;
|
||||
$$ language plpgsql;
|
||||
|
||||
SELECT add2(1,2);
|
||||
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||
ALTER SYSTEM SET pg_stat_monitor.track TO 'top';
|
||||
SELECT pg_reload_conf();
|
||||
SELECT pg_stat_monitor_reset();
|
||||
|
||||
DROP EXTENSION pg_stat_monitor;
|
||||
|
|
Loading…
Reference in New Issue