PG-178: Test cases fixes.

pull/74/head
Ibrar Ahmed 2021-02-15 12:29:03 +00:00
parent a48538523a
commit d3278c0e4c
6 changed files with 67 additions and 65 deletions

View File

@ -13,7 +13,7 @@ select pg_sleep(.5);
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 | 300 | 300 | 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_histogram_buckets | 10 | 10 | Sets the maximum number of histogram buckets | 2 | 2147483647 | 1
@ -23,8 +23,9 @@ SELECT * FROM pg_stat_monitor_settings ORDER BY name COLLATE "C";
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_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 | 0 | 0 | Selects whether utility commands are tracked. | 0 | 0 | 0
(10 rows)
(11 rows)
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset

View File

@ -97,7 +97,7 @@ EXECUTE pgss_test(1);
DEALLOCATE pgss_test;
SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | calls | rows
---------------------------------------------------+-------+------
---------------------------------------------------------------------------+-------+------
PREPARE pgss_test (int) AS SELECT $1, $2 LIMIT $3 | 1 | 1
SELECT $1 | 2 | 2
SELECT $1 +| 4 | 4
@ -109,6 +109,7 @@ SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C";
SELECT $1 AS i UNION SELECT $2 ORDER BY i | 1 | 2
SELECT $1 || $2 | 1 | 1
SELECT pg_stat_monitor_reset() | 1 | 1
SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C" | 1 | 0
WITH t(f) AS ( +| 1 | 2
VALUES ($1), ($2) +| |
) +| |
@ -233,8 +234,11 @@ SELECT 1 + 1 AS "two";
SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | calls | rows
-------+-------+------
(0 rows)
--------------------------------+-------+------
SELECT $1 | 1 | 1
SELECT $1 + $2 | 1 | 1
SELECT pg_stat_monitor_reset() | 1 | 1
(3 rows)
--
-- pg_stat_monitor.track = top
@ -289,14 +293,16 @@ SELECT PLUS_ONE(10);
SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | calls | rows
--------------------------------+-------+------
-----------------------------------+-------+------
SELECT $1 +| 1 | 1
+| |
AS "text" | |
SELECT (i + $2 + $3)::INTEGER | 2 | 2
SELECT (i + $2)::INTEGER LIMIT $3 | 2 | 2
SELECT PLUS_ONE($1) | 2 | 2
SELECT PLUS_TWO($1) | 2 | 2
SELECT pg_stat_monitor_reset() | 1 | 1
(4 rows)
(6 rows)
--
-- pg_stat_monitor.track = all
@ -386,15 +392,9 @@ NOTICE: function plus_one(pg_catalog.int4) does not exist, skipping
DROP FUNCTION PLUS_TWO(INTEGER);
SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | calls | rows
-------------------------------------------+-------+------
CREATE INDEX test_b ON test(b) | 1 | 0
DROP FUNCTION IF EXISTS PLUS_ONE(INTEGER) | 1 | 0
DROP FUNCTION PLUS_ONE(INTEGER) | 1 | 0
DROP FUNCTION PLUS_TWO(INTEGER) | 1 | 0
DROP TABLE IF EXISTS test | 3 | 0
DROP TABLE test | 1 | 0
--------------------------------+-------+------
SELECT $1 | 1 | 1
SELECT pg_stat_monitor_reset() | 1 | 1
(8 rows)
(2 rows)
DROP EXTENSION pg_stat_monitor;

View File

@ -14,7 +14,7 @@ SELECT * FROM foo1, foo2, foo3, foo4;
---+---+---+---
(0 rows)
SELECT query, relations from pg_stat_monitor;
SELECT query, relations from pg_stat_monitor ORDER BY query;
query | relations
--------------------------------------+---------------------------------------------------
SELECT * FROM foo1, foo2, foo3, foo4 | {public.foo1,public.foo2,public.foo3,public.foo4}

View File

@ -14,12 +14,13 @@ SELECT * FROM foo1, foo2, foo3, foo4;
---+---+---+---
(0 rows)
SELECT query, relations from pg_stat_monitor;
SELECT query, relations from pg_stat_monitor ORDER BY query;
query | relations
--------------------------------------+---------------------------------------------------
SELECT pg_stat_monitor_reset() |
----------------------------------------------+---------------------------------------------------
SELECT * FROM foo1, foo2, foo3, foo4 | {public.foo1,public.foo2,public.foo3,public.foo4}
(2 rows)
SELECT pg_stat_monitor_reset() |
SELECT query, relations from pg_stat_monitor |
(3 rows)
DROP TABLE foo1;
DROP TABLE foo2;

View File

@ -2551,9 +2551,9 @@ pg_stat_monitor_settings(PG_FUNCTION_ARGS)
MemoryContextSwitchTo(oldcontext);
#if PG_VERSION_NUM >= 130000
for(i = 0; i < 11; i++)
for(i = 0; i < 12; i++)
#else
for(i = 0; i < 10; i++)
for(i = 0; i < 11; i++)
#endif
{
Datum values[7];

View File

@ -5,7 +5,7 @@ CREATE TABLE foo2(a int);
CREATE TABLE foo3(a int);
CREATE TABLE foo4(a int);
SELECT * FROM foo1, foo2, foo3, foo4;
SELECT query, relations from pg_stat_monitor;
SELECT query, relations from pg_stat_monitor ORDER BY query;
DROP TABLE foo1;
DROP TABLE foo2;
DROP TABLE foo3;