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).
This commit is contained in:
Diego Fronza
2021-12-09 14:58:05 -03:00
parent b6838049b6
commit 30a328f381
9 changed files with 173 additions and 33 deletions

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;