diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/select.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/select.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/select.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/select.out 2024-10-25 07:07:36.553800740 +0000 @@ -320,96 +320,7 @@ FROM (VALUES (1, 2, 3), (4, NULL, 6), (7, 8, 9)) AS t (a, b, c) GROUP BY ROLLUP(a, b), rollup(a, c) ORDER BY a, b, c; - a | b | c ----+---+--- - 1 | 2 | 3 - 1 | 2 | - 1 | 2 | - 1 | | 3 - 1 | | 3 - 1 | | - 1 | | - 1 | | - 4 | | 6 - 4 | | 6 - 4 | | 6 - 4 | | - 4 | | - 4 | | - 4 | | - 4 | | - 7 | 8 | 9 - 7 | 8 | - 7 | 8 | - 7 | | 9 - 7 | | 9 - 7 | | - 7 | | - 7 | | - | | -(25 rows) - -SELECT a, b, c -FROM (VALUES (1, 2, 3), (4, NULL, 6), (7, 8, 9)) AS t (a, b, c) -GROUP BY DISTINCT ROLLUP(a, b), rollup(a, c) -ORDER BY a, b, c; - a | b | c ----+---+--- - 1 | 2 | 3 - 1 | 2 | - 1 | | 3 - 1 | | - 4 | | 6 - 4 | | 6 - 4 | | - 4 | | - 7 | 8 | 9 - 7 | 8 | - 7 | | 9 - 7 | | - | | -(13 rows) - -SELECT COUNT(*) FROM pg_stat_statements WHERE query LIKE '%GROUP BY%ROLLUP%'; - count -------- - 2 -(1 row) - --- GROUPING SET agglevelsup -SELECT ( - SELECT ( - SELECT GROUPING(a,b) FROM (VALUES (1)) v2(c) - ) FROM (VALUES (1,2)) v1(a,b) GROUP BY (a,b) -) FROM (VALUES(6,7)) v3(e,f) GROUP BY ROLLUP(e,f); - grouping ----------- - 0 - 0 - 0 -(3 rows) - -SELECT ( - SELECT ( - SELECT GROUPING(e,f) FROM (VALUES (1)) v2(c) - ) FROM (VALUES (1,2)) v1(a,b) GROUP BY (a,b) -) FROM (VALUES(6,7)) v3(e,f) GROUP BY ROLLUP(e,f); - grouping ----------- - 3 - 0 - 1 -(3 rows) - -SELECT COUNT(*) FROM pg_stat_statements WHERE query LIKE '%SELECT GROUPING%'; - count -------- - 2 -(1 row) - -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - +server closed the connection unexpectedly + This probably means the server terminated abnormally + before or while processing the request. +connection to server was lost diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/dml.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/dml.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/dml.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/dml.out 2024-10-25 07:07:36.729800433 +0000 @@ -73,19 +73,38 @@ (8 rows) SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C"; - calls | rows | query --------+------+--------------------------------------------------------------------- + calls | rows | query +-------+------+----------------------------------------------------------------------- 1 | 1 | DELETE FROM pgss_dml_tab WHERE a > $1 1 | 3 | INSERT INTO pgss_dml_tab (a, b) VALUES ($1, $2), ($3, $4), ($5, $6) 1 | 10 | INSERT INTO pgss_dml_tab VALUES(generate_series($1, $2), $3) + 1 | 1 | INSERT INTO tbl_inh_1 SELECT $1 + 1 | 2 | SELECT * + + | | FROM limitoption + + | | WHERE val < $1 + + | | ORDER BY val + + | | FETCH FIRST $2 ROW ONLY + 1 | 10 | SELECT * + + | | FROM limitoption + + | | WHERE val < $1 + + | | ORDER BY val + + | | FETCH FIRST $2 ROWS WITH TIES + 1 | 0 | SELECT * FROM ONLY tbl_inh 1 | 12 | SELECT * FROM pgss_dml_tab ORDER BY a 2 | 4 | SELECT * FROM pgss_dml_tab WHERE a > $1 ORDER BY a 1 | 8 | SELECT * FROM pgss_dml_tab WHERE a IN ($1, $2, $3, $4, $5) + 1 | 1 | SELECT * FROM tbl_inh + 2 | 2 | SELECT COUNT(*) FROM pg_stat_statements WHERE query LIKE $1 + 0 | 0 | SELECT a, b, c + + | | FROM (VALUES ($1, $2, $3), ($4, $5, $6), ($7, $8, $9)) AS t (a, b, c)+ + | | GROUP BY ROLLUP(a, b), rollup(a, c) + + | | ORDER BY a, b, c + 1 | 1 | SELECT dealloc FROM pg_stat_statements_info 1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t 1 | 0 | SET pg_stat_statements.track_utility = $1 6 | 6 | UPDATE pgss_dml_tab SET b = $1 WHERE a = $2 1 | 3 | UPDATE pgss_dml_tab SET b = $1 WHERE a > $2 -(10 rows) +(18 rows) SELECT pg_stat_statements_reset() IS NOT NULL AS t; t diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/level_tracking.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/level_tracking.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/level_tracking.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/level_tracking.out 2024-10-25 07:07:37.457799167 +0000 @@ -989,523 +989,7 @@ SELECT * FROM generate_series(1, 5) as id; SELECT toplevel, calls, query FROM pg_stat_statements ORDER BY query COLLATE "C"; - toplevel | calls | query -----------+-------+------------------------------------------------------ - t | 1 | CREATE MATERIALIZED VIEW pgss_materialized_view_2 AS+ - | | SELECT * FROM generate_series($1, $2) as id - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(2 rows) - --- REFRESH MATERIALIZED VIEW, all-level tracking. -SET pg_stat_statements.track = 'all'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -REFRESH MATERIALIZED VIEW pgss_materialized_view; -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C"; - toplevel | calls | query -----------+-------+---------------------------------------------------- - t | 1 | REFRESH MATERIALIZED VIEW pgss_materialized_view - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(2 rows) - --- REFRESH MATERIALIZED VIEW, top-level tracking. -SET pg_stat_statements.track = 'top'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -REFRESH MATERIALIZED VIEW pgss_materialized_view; -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C"; - toplevel | calls | query -----------+-------+---------------------------------------------------- - t | 1 | REFRESH MATERIALIZED VIEW pgss_materialized_view - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(2 rows) - --- CREATE TABLE AS, all-level tracking. -SET pg_stat_statements.track = 'all'; -PREPARE test_prepare_pgss AS select generate_series(1, 10); -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -CREATE TEMPORARY TABLE pgss_ctas_1 AS SELECT 1; -CREATE TEMPORARY TABLE pgss_ctas_2 AS EXECUTE test_prepare_pgss; -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C"; - toplevel | calls | query -----------+-------+----------------------------------------------------------------- - t | 1 | CREATE TEMPORARY TABLE pgss_ctas_1 AS SELECT $1 - t | 1 | CREATE TEMPORARY TABLE pgss_ctas_2 AS EXECUTE test_prepare_pgss - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t - f | 1 | select generate_series($1, $2) -(4 rows) - --- CREATE TABLE AS, top-level tracking. -SET pg_stat_statements.track = 'top'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -CREATE TEMPORARY TABLE pgss_ctas_3 AS SELECT 1; -CREATE TEMPORARY TABLE pgss_ctas_4 AS EXECUTE test_prepare_pgss; -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C"; - toplevel | calls | query -----------+-------+----------------------------------------------------------------- - t | 1 | CREATE TEMPORARY TABLE pgss_ctas_3 AS SELECT $1 - t | 1 | CREATE TEMPORARY TABLE pgss_ctas_4 AS EXECUTE test_prepare_pgss - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(3 rows) - --- EXPLAIN with CREATE TABLE AS - all-level tracking. -SET pg_stat_statements.track = 'all'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -EXPLAIN (COSTS OFF) CREATE TEMPORARY TABLE pgss_explain_ctas AS SELECT 1; - QUERY PLAN ------------- - Result -(1 row) - -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C"; - toplevel | calls | query -----------+-------+--------------------------------------------------------------------------- - t | 1 | EXPLAIN (COSTS OFF) CREATE TEMPORARY TABLE pgss_explain_ctas AS SELECT $1 - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(2 rows) - --- EXPLAIN with CREATE TABLE AS - top-level tracking. -SET pg_stat_statements.track = 'top'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -EXPLAIN (COSTS OFF) CREATE TEMPORARY TABLE pgss_explain_ctas AS SELECT 1; - QUERY PLAN ------------- - Result -(1 row) - -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C"; - toplevel | calls | query -----------+-------+--------------------------------------------------------------------------- - t | 1 | EXPLAIN (COSTS OFF) CREATE TEMPORARY TABLE pgss_explain_ctas AS SELECT $1 - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(2 rows) - --- DECLARE CURSOR, all-level tracking. -SET pg_stat_statements.track = 'all'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -BEGIN; -DECLARE FOOCUR CURSOR FOR SELECT * from stats_track_tab; -FETCH FORWARD 1 FROM foocur; - x ---- -(0 rows) - -CLOSE foocur; -COMMIT; -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C"; - toplevel | calls | query -----------+-------+--------------------------------------------------------- - t | 1 | BEGIN - t | 1 | CLOSE foocur - t | 1 | COMMIT - t | 1 | DECLARE FOOCUR CURSOR FOR SELECT * from stats_track_tab - t | 1 | FETCH FORWARD 1 FROM foocur - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(6 rows) - --- DECLARE CURSOR, top-level tracking. -SET pg_stat_statements.track = 'top'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -BEGIN; -DECLARE FOOCUR CURSOR FOR SELECT * FROM stats_track_tab; -FETCH FORWARD 1 FROM foocur; - x ---- -(0 rows) - -CLOSE foocur; -COMMIT; -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C"; - toplevel | calls | query -----------+-------+--------------------------------------------------------- - t | 1 | BEGIN - t | 1 | CLOSE foocur - t | 1 | COMMIT - t | 1 | DECLARE FOOCUR CURSOR FOR SELECT * FROM stats_track_tab - t | 1 | FETCH FORWARD 1 FROM foocur - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(6 rows) - --- COPY - all-level tracking. -SET pg_stat_statements.track = 'all'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -COPY (SELECT 1) TO stdout; -1 -COPY (SELECT 1 UNION SELECT 2) TO stdout; -1 -2 -COPY (MERGE INTO stats_track_tab USING (SELECT 1 id) ON x = id - WHEN MATCHED THEN UPDATE SET x = id - WHEN NOT MATCHED THEN INSERT (x) VALUES (id) RETURNING x) TO stdout; -1 -COPY (INSERT INTO stats_track_tab (x) VALUES (1) RETURNING x) TO stdout; -1 -COPY (UPDATE stats_track_tab SET x = 2 WHERE x = 1 RETURNING x) TO stdout; -2 -2 -COPY (DELETE FROM stats_track_tab WHERE x = 2 RETURNING x) TO stdout; -2 -2 -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C"; - toplevel | calls | query -----------+-------+--------------------------------------------------------------------------- - t | 1 | COPY (DELETE FROM stats_track_tab WHERE x = 2 RETURNING x) TO stdout - t | 1 | COPY (INSERT INTO stats_track_tab (x) VALUES (1) RETURNING x) TO stdout - t | 1 | COPY (MERGE INTO stats_track_tab USING (SELECT 1 id) ON x = id + - | | WHEN MATCHED THEN UPDATE SET x = id + - | | WHEN NOT MATCHED THEN INSERT (x) VALUES (id) RETURNING x) TO stdout - t | 1 | COPY (SELECT 1 UNION SELECT 2) TO stdout - t | 1 | COPY (SELECT 1) TO stdout - t | 1 | COPY (UPDATE stats_track_tab SET x = 2 WHERE x = 1 RETURNING x) TO stdout - f | 1 | DELETE FROM stats_track_tab WHERE x = $1 RETURNING x - f | 1 | INSERT INTO stats_track_tab (x) VALUES ($1) RETURNING x - f | 1 | MERGE INTO stats_track_tab USING (SELECT $1 id) ON x = id + - | | WHEN MATCHED THEN UPDATE SET x = id + - | | WHEN NOT MATCHED THEN INSERT (x) VALUES (id) RETURNING x - f | 1 | SELECT $1 - f | 1 | SELECT $1 UNION SELECT $2 - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t - f | 1 | UPDATE stats_track_tab SET x = $1 WHERE x = $2 RETURNING x -(13 rows) - --- COPY - top-level tracking. -SET pg_stat_statements.track = 'top'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -COPY (SELECT 1) TO stdout; -1 -COPY (SELECT 1 UNION SELECT 2) TO stdout; -1 -2 -COPY (MERGE INTO stats_track_tab USING (SELECT 1 id) ON x = id - WHEN MATCHED THEN UPDATE SET x = id - WHEN NOT MATCHED THEN INSERT (x) VALUES (id) RETURNING x) TO stdout; -1 -COPY (INSERT INTO stats_track_tab (x) VALUES (1) RETURNING x) TO stdout; -1 -COPY (UPDATE stats_track_tab SET x = 2 WHERE x = 1 RETURNING x) TO stdout; -2 -2 -COPY (DELETE FROM stats_track_tab WHERE x = 2 RETURNING x) TO stdout; -2 -2 -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C"; - toplevel | calls | query -----------+-------+--------------------------------------------------------------------------- - t | 1 | COPY (DELETE FROM stats_track_tab WHERE x = 2 RETURNING x) TO stdout - t | 1 | COPY (INSERT INTO stats_track_tab (x) VALUES (1) RETURNING x) TO stdout - t | 1 | COPY (MERGE INTO stats_track_tab USING (SELECT 1 id) ON x = id + - | | WHEN MATCHED THEN UPDATE SET x = id + - | | WHEN NOT MATCHED THEN INSERT (x) VALUES (id) RETURNING x) TO stdout - t | 1 | COPY (SELECT 1 UNION SELECT 2) TO stdout - t | 1 | COPY (SELECT 1) TO stdout - t | 1 | COPY (UPDATE stats_track_tab SET x = 2 WHERE x = 1 RETURNING x) TO stdout - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(7 rows) - --- DO block - top-level tracking without utility. -SET pg_stat_statements.track = 'top'; -SET pg_stat_statements.track_utility = FALSE; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -DELETE FROM stats_track_tab; -DO $$ -BEGIN - DELETE FROM stats_track_tab; -END; $$; -DO LANGUAGE plpgsql $$ -BEGIN - -- this is a SELECT - PERFORM 'hello world'::TEXT; -END; $$; -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C", toplevel; - toplevel | calls | query -----------+-------+---------------------------------------------------- - t | 1 | DELETE FROM stats_track_tab - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(2 rows) - --- DO block - all-level tracking without utility. -SET pg_stat_statements.track = 'all'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -DELETE FROM stats_track_tab; -DO $$ -BEGIN - DELETE FROM stats_track_tab; -END; $$; -DO LANGUAGE plpgsql $$ -BEGIN - -- this is a SELECT - PERFORM 'hello world'::TEXT; -END; $$; -SELECT toplevel, calls, query FROM pg_stat_statements - ORDER BY query COLLATE "C", toplevel; - toplevel | calls | query -----------+-------+---------------------------------------------------- - f | 1 | DELETE FROM stats_track_tab - t | 1 | DELETE FROM stats_track_tab - f | 1 | SELECT $1::TEXT - t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(4 rows) - --- PL/pgSQL function - top-level tracking. -SET pg_stat_statements.track = 'top'; -SET pg_stat_statements.track_utility = FALSE; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -CREATE FUNCTION PLUS_TWO(i INTEGER) RETURNS INTEGER AS $$ -DECLARE - r INTEGER; -BEGIN - SELECT (i + 1 + 1.0)::INTEGER INTO r; - RETURN r; -END; $$ LANGUAGE plpgsql; -SELECT PLUS_TWO(3); - plus_two ----------- - 5 -(1 row) - -SELECT PLUS_TWO(7); - plus_two ----------- - 9 -(1 row) - --- SQL function --- use LIMIT to keep it from being inlined -CREATE FUNCTION PLUS_ONE(i INTEGER) RETURNS INTEGER AS -$$ SELECT (i + 1.0)::INTEGER LIMIT 1 $$ LANGUAGE SQL; -SELECT PLUS_ONE(8); - plus_one ----------- - 9 -(1 row) - -SELECT PLUS_ONE(10); - plus_one ----------- - 11 -(1 row) - -SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C"; - calls | rows | query --------+------+---------------------------------------------------- - 2 | 2 | SELECT PLUS_ONE($1) - 2 | 2 | SELECT PLUS_TWO($1) - 1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(3 rows) - --- immutable SQL function --- can be executed at plan time -CREATE FUNCTION PLUS_THREE(i INTEGER) RETURNS INTEGER AS -$$ SELECT i + 3 LIMIT 1 $$ IMMUTABLE LANGUAGE SQL; -SELECT PLUS_THREE(8); - plus_three ------------- - 11 -(1 row) - -SELECT PLUS_THREE(10); - plus_three ------------- - 13 -(1 row) - -SELECT toplevel, calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C"; - toplevel | calls | rows | query -----------+-------+------+------------------------------------------------------------------------------ - t | 2 | 2 | SELECT PLUS_ONE($1) - t | 2 | 2 | SELECT PLUS_THREE($1) - t | 2 | 2 | SELECT PLUS_TWO($1) - t | 1 | 3 | SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C" - t | 1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(5 rows) - --- PL/pgSQL function - all-level tracking. -SET pg_stat_statements.track = 'all'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - --- we drop and recreate the functions to avoid any caching funnies -DROP FUNCTION PLUS_ONE(INTEGER); -DROP FUNCTION PLUS_TWO(INTEGER); -DROP FUNCTION PLUS_THREE(INTEGER); --- PL/pgSQL function -CREATE FUNCTION PLUS_TWO(i INTEGER) RETURNS INTEGER AS $$ -DECLARE - r INTEGER; -BEGIN - SELECT (i + 1 + 1.0)::INTEGER INTO r; - RETURN r; -END; $$ LANGUAGE plpgsql; -SELECT PLUS_TWO(-1); - plus_two ----------- - 1 -(1 row) - -SELECT PLUS_TWO(2); - plus_two ----------- - 4 -(1 row) - --- SQL function --- use LIMIT to keep it from being inlined -CREATE FUNCTION PLUS_ONE(i INTEGER) RETURNS INTEGER AS -$$ SELECT (i + 1.0)::INTEGER LIMIT 1 $$ LANGUAGE SQL; -SELECT PLUS_ONE(3); - plus_one ----------- - 4 -(1 row) - -SELECT PLUS_ONE(1); - plus_one ----------- - 2 -(1 row) - -SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C"; - calls | rows | query --------+------+---------------------------------------------------- - 2 | 2 | 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) - 1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(5 rows) - --- immutable SQL function --- can be executed at plan time -CREATE FUNCTION PLUS_THREE(i INTEGER) RETURNS INTEGER AS -$$ SELECT i + 3 LIMIT 1 $$ IMMUTABLE LANGUAGE SQL; -SELECT PLUS_THREE(8); - plus_three ------------- - 11 -(1 row) - -SELECT PLUS_THREE(10); - plus_three ------------- - 13 -(1 row) - -SELECT toplevel, calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C"; - toplevel | calls | rows | query -----------+-------+------+------------------------------------------------------------------------------ - f | 2 | 2 | SELECT (i + $2 + $3)::INTEGER - f | 2 | 2 | SELECT (i + $2)::INTEGER LIMIT $3 - t | 2 | 2 | SELECT PLUS_ONE($1) - t | 2 | 2 | SELECT PLUS_THREE($1) - t | 2 | 2 | SELECT PLUS_TWO($1) - t | 1 | 5 | SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C" - f | 2 | 2 | SELECT i + $2 LIMIT $3 - t | 1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(8 rows) - --- --- pg_stat_statements.track = none --- -SET pg_stat_statements.track = 'none'; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -SELECT 1 AS "one"; - one ------ - 1 -(1 row) - -SELECT 1 + 1 AS "two"; - two ------ - 2 -(1 row) - -SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C"; - calls | rows | query --------+------+------- -(0 rows) - -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - +server closed the connection unexpectedly + This probably means the server terminated abnormally + before or while processing the request. +connection to server was lost diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/planning.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/planning.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/planning.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/planning.out 2024-10-25 07:07:37.525799048 +0000 @@ -1,88 +1,2 @@ --- --- Information related to planning --- --- These tests require track_planning to be enabled. -SET pg_stat_statements.track_planning = TRUE; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - --- --- [re]plan counting --- -CREATE TABLE stats_plan_test (); -PREPARE prep1 AS SELECT COUNT(*) FROM stats_plan_test; -EXECUTE prep1; - count -------- - 0 -(1 row) - -EXECUTE prep1; - count -------- - 0 -(1 row) - -EXECUTE prep1; - count -------- - 0 -(1 row) - -ALTER TABLE stats_plan_test ADD COLUMN x int; -EXECUTE prep1; - count -------- - 0 -(1 row) - -SELECT 42; - ?column? ----------- - 42 -(1 row) - -SELECT 42; - ?column? ----------- - 42 -(1 row) - -SELECT 42; - ?column? ----------- - 42 -(1 row) - -SELECT plans, calls, rows, query FROM pg_stat_statements - WHERE query NOT LIKE 'SELECT COUNT%' ORDER BY query COLLATE "C"; - plans | calls | rows | query --------+-------+------+---------------------------------------------------------- - 0 | 1 | 0 | ALTER TABLE stats_plan_test ADD COLUMN x int - 0 | 1 | 0 | CREATE TABLE stats_plan_test () - 3 | 3 | 3 | SELECT $1 - 0 | 1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t - 1 | 0 | 0 | SELECT plans, calls, rows, query FROM pg_stat_statements+ - | | | WHERE query NOT LIKE $1 ORDER BY query COLLATE "C" -(5 rows) - --- for the prepared statement we expect at least one replan, but cache --- invalidations could force more -SELECT plans >= 2 AND plans <= calls AS plans_ok, calls, rows, query FROM pg_stat_statements - WHERE query LIKE 'SELECT COUNT%' ORDER BY query COLLATE "C"; - plans_ok | calls | rows | query -----------+-------+------+-------------------------------------- - t | 4 | 4 | SELECT COUNT(*) FROM stats_plan_test -(1 row) - --- Cleanup -DROP TABLE stats_plan_test; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - +psql: error: connection to server on socket "/tmp/pg_regress-p00GR5/.s.PGSQL.65312" failed: No such file or directory + Is the server running locally and accepting connections on that socket? diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/user_activity.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/user_activity.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/user_activity.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/user_activity.out 2024-10-25 07:07:37.597798923 +0000 @@ -1,209 +1,2 @@ --- --- Track user activity and reset them --- -SET pg_stat_statements.track_utility = TRUE; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -CREATE ROLE regress_stats_user1; -CREATE ROLE regress_stats_user2; -SET ROLE regress_stats_user1; -SELECT 1 AS "ONE"; - ONE ------ - 1 -(1 row) - -SELECT 1+1 AS "TWO"; - TWO ------ - 2 -(1 row) - -RESET ROLE; -SET ROLE regress_stats_user2; -SELECT 1 AS "ONE"; - ONE ------ - 1 -(1 row) - -SELECT 1+1 AS "TWO"; - TWO ------ - 2 -(1 row) - -RESET ROLE; -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; - query | calls | rows -----------------------------------------------------+-------+------ - CREATE ROLE regress_stats_user1 | 1 | 0 - CREATE ROLE regress_stats_user2 | 1 | 0 - RESET ROLE | 2 | 0 - SELECT $1 AS "ONE" | 1 | 1 - SELECT $1 AS "ONE" | 1 | 1 - SELECT $1+$2 AS "TWO" | 1 | 1 - SELECT $1+$2 AS "TWO" | 1 | 1 - SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1 | 1 - SET ROLE regress_stats_user1 | 1 | 0 - SET ROLE regress_stats_user2 | 1 | 0 -(10 rows) - --- --- Don't reset anything if any of the parameter is NULL --- -SELECT pg_stat_statements_reset(NULL) IS NOT NULL AS t; - t ---- - f -(1 row) - -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; - query | calls | rows -------------------------------------------------------------------------------+-------+------ - CREATE ROLE regress_stats_user1 | 1 | 0 - CREATE ROLE regress_stats_user2 | 1 | 0 - RESET ROLE | 2 | 0 - SELECT $1 AS "ONE" | 1 | 1 - SELECT $1 AS "ONE" | 1 | 1 - SELECT $1+$2 AS "TWO" | 1 | 1 - SELECT $1+$2 AS "TWO" | 1 | 1 - SELECT pg_stat_statements_reset($1) IS NOT NULL AS t | 1 | 1 - SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1 | 1 - SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C" | 1 | 10 - SET ROLE regress_stats_user1 | 1 | 0 - SET ROLE regress_stats_user2 | 1 | 0 -(12 rows) - --- --- remove query ('SELECT $1+$2 AS "TWO"') executed by regress_stats_user2 --- in the current_database --- -SELECT pg_stat_statements_reset( - (SELECT r.oid FROM pg_roles AS r WHERE r.rolname = 'regress_stats_user2'), - (SELECT d.oid FROM pg_database As d where datname = current_database()), - (SELECT s.queryid FROM pg_stat_statements AS s - WHERE s.query = 'SELECT $1+$2 AS "TWO"' LIMIT 1)) - IS NOT NULL AS t; - t ---- - t -(1 row) - -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; - query | calls | rows -----------------------------------------------------------------------------------+-------+------ - CREATE ROLE regress_stats_user1 | 1 | 0 - CREATE ROLE regress_stats_user2 | 1 | 0 - RESET ROLE | 2 | 0 - SELECT $1 AS "ONE" | 1 | 1 - SELECT $1 AS "ONE" | 1 | 1 - SELECT $1+$2 AS "TWO" | 1 | 1 - SELECT pg_stat_statements_reset( +| 1 | 1 - (SELECT r.oid FROM pg_roles AS r WHERE r.rolname = $1), +| | - (SELECT d.oid FROM pg_database As d where datname = current_database()),+| | - (SELECT s.queryid FROM pg_stat_statements AS s +| | - WHERE s.query = $2 LIMIT $3)) +| | - IS NOT NULL AS t | | - SELECT pg_stat_statements_reset($1) IS NOT NULL AS t | 1 | 1 - SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1 | 1 - SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C" | 2 | 22 - SET ROLE regress_stats_user1 | 1 | 0 - SET ROLE regress_stats_user2 | 1 | 0 -(12 rows) - --- --- remove query ('SELECT $1 AS "ONE"') executed by two users --- -SELECT pg_stat_statements_reset(0,0,s.queryid) IS NOT NULL AS t - FROM pg_stat_statements AS s WHERE s.query = 'SELECT $1 AS "ONE"'; - t ---- - t - t -(2 rows) - -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; - query | calls | rows -----------------------------------------------------------------------------------+-------+------ - CREATE ROLE regress_stats_user1 | 1 | 0 - CREATE ROLE regress_stats_user2 | 1 | 0 - RESET ROLE | 2 | 0 - SELECT $1+$2 AS "TWO" | 1 | 1 - SELECT pg_stat_statements_reset( +| 1 | 1 - (SELECT r.oid FROM pg_roles AS r WHERE r.rolname = $1), +| | - (SELECT d.oid FROM pg_database As d where datname = current_database()),+| | - (SELECT s.queryid FROM pg_stat_statements AS s +| | - WHERE s.query = $2 LIMIT $3)) +| | - IS NOT NULL AS t | | - SELECT pg_stat_statements_reset($1) IS NOT NULL AS t | 1 | 1 - SELECT pg_stat_statements_reset($1,$2,s.queryid) IS NOT NULL AS t +| 1 | 2 - FROM pg_stat_statements AS s WHERE s.query = $3 | | - SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1 | 1 - SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C" | 3 | 34 - SET ROLE regress_stats_user1 | 1 | 0 - SET ROLE regress_stats_user2 | 1 | 0 -(11 rows) - --- --- remove query of a user (regress_stats_user1) --- -SELECT pg_stat_statements_reset(r.oid) IS NOT NULL AS t - FROM pg_roles AS r WHERE r.rolname = 'regress_stats_user1'; - t ---- - t -(1 row) - -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; - query | calls | rows -----------------------------------------------------------------------------------+-------+------ - CREATE ROLE regress_stats_user1 | 1 | 0 - CREATE ROLE regress_stats_user2 | 1 | 0 - RESET ROLE | 2 | 0 - SELECT pg_stat_statements_reset( +| 1 | 1 - (SELECT r.oid FROM pg_roles AS r WHERE r.rolname = $1), +| | - (SELECT d.oid FROM pg_database As d where datname = current_database()),+| | - (SELECT s.queryid FROM pg_stat_statements AS s +| | - WHERE s.query = $2 LIMIT $3)) +| | - IS NOT NULL AS t | | - SELECT pg_stat_statements_reset($1) IS NOT NULL AS t | 1 | 1 - SELECT pg_stat_statements_reset($1,$2,s.queryid) IS NOT NULL AS t +| 1 | 2 - FROM pg_stat_statements AS s WHERE s.query = $3 | | - SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1 | 1 - SELECT pg_stat_statements_reset(r.oid) IS NOT NULL AS t +| 1 | 1 - FROM pg_roles AS r WHERE r.rolname = $1 | | - SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C" | 4 | 45 - SET ROLE regress_stats_user2 | 1 | 0 -(10 rows) - --- --- reset all --- -SELECT pg_stat_statements_reset(0,0,0) IS NOT NULL AS t; - t ---- - t -(1 row) - -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; - query | calls | rows ----------------------------------------------------------+-------+------ - SELECT pg_stat_statements_reset(0,0,0) IS NOT NULL AS t | 1 | 1 -(1 row) - --- --- cleanup --- -DROP ROLE regress_stats_user1; -DROP ROLE regress_stats_user2; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - +psql: error: connection to server on socket "/tmp/pg_regress-p00GR5/.s.PGSQL.65312" failed: No such file or directory + Is the server running locally and accepting connections on that socket? diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/wal.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/wal.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/wal.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/wal.out 2024-10-25 07:07:37.617798889 +0000 @@ -1,30 +1,2 @@ --- --- Validate WAL generation metrics --- -SET pg_stat_statements.track_utility = FALSE; -CREATE TABLE pgss_wal_tab (a int, b char(20)); -INSERT INTO pgss_wal_tab VALUES(generate_series(1, 10), 'aaa'); -UPDATE pgss_wal_tab SET b = 'bbb' WHERE a > 7; -DELETE FROM pgss_wal_tab WHERE a > 9; -DROP TABLE pgss_wal_tab; --- Check WAL is generated for the above statements -SELECT query, calls, rows, -wal_bytes > 0 as wal_bytes_generated, -wal_records > 0 as wal_records_generated, -wal_records >= rows as wal_records_ge_rows -FROM pg_stat_statements ORDER BY query COLLATE "C"; - query | calls | rows | wal_bytes_generated | wal_records_generated | wal_records_ge_rows ---------------------------------------------------------------+-------+------+---------------------+-----------------------+--------------------- - DELETE FROM pgss_wal_tab WHERE a > $1 | 1 | 1 | t | t | t - INSERT INTO pgss_wal_tab VALUES(generate_series($1, $2), $3) | 1 | 10 | t | t | t - SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1 | 1 | f | f | f - SET pg_stat_statements.track_utility = $1 | 1 | 0 | f | f | t - UPDATE pgss_wal_tab SET b = $1 WHERE a > $2 | 1 | 3 | t | t | t -(5 rows) - -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - +psql: error: connection to server on socket "/tmp/pg_regress-p00GR5/.s.PGSQL.65312" failed: No such file or directory + Is the server running locally and accepting connections on that socket? diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/entry_timestamp.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/entry_timestamp.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/entry_timestamp.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/entry_timestamp.out 2024-10-25 07:07:37.649798833 +0000 @@ -1,159 +1,2 @@ --- --- statement timestamps --- --- planning time is needed during tests -SET pg_stat_statements.track_planning = TRUE; -SELECT 1 AS "STMTTS1"; - STMTTS1 ---------- - 1 -(1 row) - -SELECT now() AS ref_ts \gset -SELECT 1,2 AS "STMTTS2"; - ?column? | STMTTS2 -----------+--------- - 1 | 2 -(1 row) - -SELECT stats_since >= :'ref_ts', count(*) FROM pg_stat_statements -WHERE query LIKE '%STMTTS%' -GROUP BY stats_since >= :'ref_ts' -ORDER BY stats_since >= :'ref_ts'; - ?column? | count -----------+------- - f | 1 - t | 1 -(2 rows) - -SELECT now() AS ref_ts \gset -SELECT - count(*) as total, - count(*) FILTER ( - WHERE min_plan_time + max_plan_time = 0 - ) as minmax_plan_zero, - count(*) FILTER ( - WHERE min_exec_time + max_exec_time = 0 - ) as minmax_exec_zero, - count(*) FILTER ( - WHERE minmax_stats_since >= :'ref_ts' - ) as minmax_stats_since_after_ref, - count(*) FILTER ( - WHERE stats_since >= :'ref_ts' - ) as stats_since_after_ref -FROM pg_stat_statements -WHERE query LIKE '%STMTTS%'; - total | minmax_plan_zero | minmax_exec_zero | minmax_stats_since_after_ref | stats_since_after_ref --------+------------------+------------------+------------------------------+----------------------- - 2 | 0 | 0 | 0 | 0 -(1 row) - --- Perform single min/max reset -SELECT pg_stat_statements_reset(0, 0, queryid, true) AS minmax_reset_ts -FROM pg_stat_statements -WHERE query LIKE '%STMTTS1%' \gset --- check -SELECT - count(*) as total, - count(*) FILTER ( - WHERE min_plan_time + max_plan_time = 0 - ) as minmax_plan_zero, - count(*) FILTER ( - WHERE min_exec_time + max_exec_time = 0 - ) as minmax_exec_zero, - count(*) FILTER ( - WHERE minmax_stats_since >= :'ref_ts' - ) as minmax_stats_since_after_ref, - count(*) FILTER ( - WHERE stats_since >= :'ref_ts' - ) as stats_since_after_ref -FROM pg_stat_statements -WHERE query LIKE '%STMTTS%'; - total | minmax_plan_zero | minmax_exec_zero | minmax_stats_since_after_ref | stats_since_after_ref --------+------------------+------------------+------------------------------+----------------------- - 2 | 1 | 1 | 1 | 0 -(1 row) - --- check minmax reset timestamps -SELECT -query, minmax_stats_since = :'minmax_reset_ts' AS reset_ts_match -FROM pg_stat_statements -WHERE query LIKE '%STMTTS%' -ORDER BY query COLLATE "C"; - query | reset_ts_match ----------------------------+---------------- - SELECT $1 AS "STMTTS1" | t - SELECT $1,$2 AS "STMTTS2" | f -(2 rows) - --- check that minmax reset does not set stats_reset -SELECT -stats_reset = :'minmax_reset_ts' AS stats_reset_ts_match -FROM pg_stat_statements_info; - stats_reset_ts_match ----------------------- - f -(1 row) - --- Perform common min/max reset -SELECT pg_stat_statements_reset(0, 0, 0, true) AS minmax_reset_ts \gset --- check again -SELECT - count(*) as total, - count(*) FILTER ( - WHERE min_plan_time + max_plan_time = 0 - ) as minmax_plan_zero, - count(*) FILTER ( - WHERE min_exec_time + max_exec_time = 0 - ) as minmax_exec_zero, - count(*) FILTER ( - WHERE minmax_stats_since >= :'ref_ts' - ) as minmax_ts_after_ref, - count(*) FILTER ( - WHERE minmax_stats_since = :'minmax_reset_ts' - ) as minmax_ts_match, - count(*) FILTER ( - WHERE stats_since >= :'ref_ts' - ) as stats_since_after_ref -FROM pg_stat_statements -WHERE query LIKE '%STMTTS%'; - total | minmax_plan_zero | minmax_exec_zero | minmax_ts_after_ref | minmax_ts_match | stats_since_after_ref --------+------------------+------------------+---------------------+-----------------+----------------------- - 2 | 2 | 2 | 2 | 2 | 0 -(1 row) - --- Execute first query once more to check stats update -SELECT 1 AS "STMTTS1"; - STMTTS1 ---------- - 1 -(1 row) - --- check --- we don't check planing times here to be independent of --- plan caching approach -SELECT - count(*) as total, - count(*) FILTER ( - WHERE min_exec_time + max_exec_time = 0 - ) as minmax_exec_zero, - count(*) FILTER ( - WHERE minmax_stats_since >= :'ref_ts' - ) as minmax_ts_after_ref, - count(*) FILTER ( - WHERE stats_since >= :'ref_ts' - ) as stats_since_after_ref -FROM pg_stat_statements -WHERE query LIKE '%STMTTS%'; - total | minmax_exec_zero | minmax_ts_after_ref | stats_since_after_ref --------+------------------+---------------------+----------------------- - 2 | 1 | 2 | 0 -(1 row) - --- Cleanup -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - +psql: error: connection to server on socket "/tmp/pg_regress-p00GR5/.s.PGSQL.65312" failed: No such file or directory + Is the server running locally and accepting connections on that socket? diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/privileges.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/privileges.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/privileges.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/privileges.out 2024-10-25 07:07:37.741798674 +0000 @@ -1,97 +1,2 @@ --- --- Only superusers and roles with privileges of the pg_read_all_stats role --- are allowed to see the SQL text and queryid of queries executed by --- other users. Other users can see the statistics. --- -SET pg_stat_statements.track_utility = FALSE; -CREATE ROLE regress_stats_superuser SUPERUSER; -CREATE ROLE regress_stats_user1; -CREATE ROLE regress_stats_user2; -GRANT pg_read_all_stats TO regress_stats_user2; -SET ROLE regress_stats_superuser; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -SELECT 1 AS "ONE"; - ONE ------ - 1 -(1 row) - -SET ROLE regress_stats_user1; -SELECT 1+1 AS "TWO"; - TWO ------ - 2 -(1 row) - --- --- A superuser can read all columns of queries executed by others, --- including query text and queryid. --- -SET ROLE regress_stats_superuser; -SELECT r.rolname, ss.queryid <> 0 AS queryid_bool, ss.query, ss.calls, ss.rows - FROM pg_stat_statements ss JOIN pg_roles r ON ss.userid = r.oid - ORDER BY r.rolname, ss.query COLLATE "C", ss.calls, ss.rows; - rolname | queryid_bool | query | calls | rows --------------------------+--------------+----------------------------------------------------+-------+------ - regress_stats_superuser | t | SELECT $1 AS "ONE" | 1 | 1 - regress_stats_superuser | t | SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1 | 1 - regress_stats_user1 | t | SELECT $1+$2 AS "TWO" | 1 | 1 -(3 rows) - --- --- regress_stats_user1 has no privileges to read the query text or --- queryid of queries executed by others but can see statistics --- like calls and rows. --- -SET ROLE regress_stats_user1; -SELECT r.rolname, ss.queryid <> 0 AS queryid_bool, ss.query, ss.calls, ss.rows - FROM pg_stat_statements ss JOIN pg_roles r ON ss.userid = r.oid - ORDER BY r.rolname, ss.query COLLATE "C", ss.calls, ss.rows; - rolname | queryid_bool | query | calls | rows --------------------------+--------------+--------------------------+-------+------ - regress_stats_superuser | | | 1 | 1 - regress_stats_superuser | | | 1 | 1 - regress_stats_superuser | | | 1 | 3 - regress_stats_user1 | t | SELECT $1+$2 AS "TWO" | 1 | 1 -(4 rows) - --- --- regress_stats_user2, with pg_read_all_stats role privileges, can --- read all columns, including query text and queryid, of queries --- executed by others. --- -SET ROLE regress_stats_user2; -SELECT r.rolname, ss.queryid <> 0 AS queryid_bool, ss.query, ss.calls, ss.rows - FROM pg_stat_statements ss JOIN pg_roles r ON ss.userid = r.oid - ORDER BY r.rolname, ss.query COLLATE "C", ss.calls, ss.rows; - rolname | queryid_bool | query | calls | rows --------------------------+--------------+---------------------------------------------------------------------------------+-------+------ - regress_stats_superuser | t | SELECT $1 AS "ONE" | 1 | 1 - regress_stats_superuser | t | SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1 | 1 - regress_stats_superuser | t | SELECT r.rolname, ss.queryid <> $1 AS queryid_bool, ss.query, ss.calls, ss.rows+| 1 | 3 - | | FROM pg_stat_statements ss JOIN pg_roles r ON ss.userid = r.oid +| | - | | ORDER BY r.rolname, ss.query COLLATE "C", ss.calls, ss.rows | | - regress_stats_user1 | t | SELECT $1+$2 AS "TWO" | 1 | 1 - regress_stats_user1 | t | SELECT r.rolname, ss.queryid <> $1 AS queryid_bool, ss.query, ss.calls, ss.rows+| 1 | 4 - | | FROM pg_stat_statements ss JOIN pg_roles r ON ss.userid = r.oid +| | - | | ORDER BY r.rolname, ss.query COLLATE "C", ss.calls, ss.rows | | -(5 rows) - --- --- cleanup --- -RESET ROLE; -DROP ROLE regress_stats_superuser; -DROP ROLE regress_stats_user1; -DROP ROLE regress_stats_user2; -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - +psql: error: connection to server on socket "/tmp/pg_regress-p00GR5/.s.PGSQL.65312" failed: No such file or directory + Is the server running locally and accepting connections on that socket? diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/extended.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/extended.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/extended.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/extended.out 2024-10-25 07:07:37.777798611 +0000 @@ -1,70 +1,2 @@ --- Tests with extended query protocol -SET pg_stat_statements.track_utility = FALSE; --- This test checks that an execute message sets a query ID. -SELECT query_id IS NOT NULL AS query_id_set - FROM pg_stat_activity WHERE pid = pg_backend_pid() \bind \g - query_id_set --------------- - t -(1 row) - -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -SELECT $1 \parse stmt1 -SELECT $1, $2 \parse stmt2 -SELECT $1, $2, $3 \parse stmt3 -SELECT $1 \bind 'unnamed_val1' \g - ?column? --------------- - unnamed_val1 -(1 row) - -\bind_named stmt1 'stmt1_val1' \g - ?column? ------------- - stmt1_val1 -(1 row) - -\bind_named stmt2 'stmt2_val1' 'stmt2_val2' \g - ?column? | ?column? -------------+------------ - stmt2_val1 | stmt2_val2 -(1 row) - -\bind_named stmt3 'stmt3_val1' 'stmt3_val2' 'stmt3_val3' \g - ?column? | ?column? | ?column? -------------+------------+------------ - stmt3_val1 | stmt3_val2 | stmt3_val3 -(1 row) - -\bind_named stmt3 'stmt3_val4' 'stmt3_val5' 'stmt3_val6' \g - ?column? | ?column? | ?column? -------------+------------+------------ - stmt3_val4 | stmt3_val5 | stmt3_val6 -(1 row) - -\bind_named stmt2 'stmt2_val3' 'stmt2_val4' \g - ?column? | ?column? -------------+------------ - stmt2_val3 | stmt2_val4 -(1 row) - -\bind_named stmt1 'stmt1_val1' \g - ?column? ------------- - stmt1_val1 -(1 row) - -SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C"; - calls | rows | query --------+------+---------------------------------------------------- - 3 | 3 | SELECT $1 - 2 | 2 | SELECT $1, $2 - 2 | 2 | SELECT $1, $2, $3 - 1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(4 rows) - +psql: error: connection to server on socket "/tmp/pg_regress-p00GR5/.s.PGSQL.65312" failed: No such file or directory + Is the server running locally and accepting connections on that socket? diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/parallel.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/parallel.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/parallel.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/parallel.out 2024-10-25 07:07:37.845798493 +0000 @@ -1,34 +1,2 @@ --- --- Tests for parallel statistics --- -SET pg_stat_statements.track_utility = FALSE; --- encourage use of parallel plans -SET parallel_setup_cost = 0; -SET parallel_tuple_cost = 0; -SET min_parallel_table_scan_size = 0; -SET max_parallel_workers_per_gather = 2; -CREATE TABLE pgss_parallel_tab (a int); -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - -SELECT count(*) FROM pgss_parallel_tab; - count -------- - 0 -(1 row) - -SELECT query, - parallel_workers_to_launch > 0 AS has_workers_to_launch, - parallel_workers_launched > 0 AS has_workers_launched - FROM pg_stat_statements - WHERE query ~ 'SELECT count' - ORDER BY query COLLATE "C"; - query | has_workers_to_launch | has_workers_launched -----------------------------------------+-----------------------+---------------------- - SELECT count(*) FROM pgss_parallel_tab | t | t -(1 row) - -DROP TABLE pgss_parallel_tab; +psql: error: connection to server on socket "/tmp/pg_regress-p00GR5/.s.PGSQL.65312" failed: No such file or directory + Is the server running locally and accepting connections on that socket? diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/cleanup.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/cleanup.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/cleanup.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/cleanup.out 2024-10-25 07:07:37.965798285 +0000 @@ -1 +1,2 @@ -DROP EXTENSION pg_stat_statements; +psql: error: connection to server on socket "/tmp/pg_regress-p00GR5/.s.PGSQL.65312" failed: No such file or directory + Is the server running locally and accepting connections on that socket? diff -U3 /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/oldextversions.out /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/oldextversions.out --- /tmp/cirrus-ci-build/contrib/pg_stat_statements/expected/oldextversions.out 2024-10-25 07:03:29.651572781 +0000 +++ /tmp/cirrus-ci-build/contrib/pg_stat_statements/results/oldextversions.out 2024-10-25 07:07:38.089798071 +0000 @@ -1,409 +1,2 @@ --- test old extension version entry points -CREATE EXTENSION pg_stat_statements WITH VERSION '1.4'; --- Execution of pg_stat_statements_reset() is granted only to --- superusers in 1.4, so this fails. -SET SESSION AUTHORIZATION pg_read_all_stats; -SELECT pg_stat_statements_reset(); -ERROR: permission denied for function pg_stat_statements_reset -RESET SESSION AUTHORIZATION; -AlTER EXTENSION pg_stat_statements UPDATE TO '1.5'; --- Execution of pg_stat_statements_reset() should be granted to --- pg_read_all_stats now, so this works. -SET SESSION AUTHORIZATION pg_read_all_stats; -SELECT pg_stat_statements_reset(); - pg_stat_statements_reset --------------------------- - -(1 row) - -RESET SESSION AUTHORIZATION; --- In 1.6, it got restricted back to superusers. -AlTER EXTENSION pg_stat_statements UPDATE TO '1.6'; -SET SESSION AUTHORIZATION pg_read_all_stats; -SELECT pg_stat_statements_reset(); -ERROR: permission denied for function pg_stat_statements_reset -RESET SESSION AUTHORIZATION; -SELECT pg_get_functiondef('pg_stat_statements_reset'::regproc); - pg_get_functiondef -------------------------------------------------------------------------------- - CREATE OR REPLACE FUNCTION public.pg_stat_statements_reset() + - RETURNS void + - LANGUAGE c + - PARALLEL SAFE + - AS '$libdir/pg_stat_statements', $function$pg_stat_statements_reset$function$+ - -(1 row) - --- New function for pg_stat_statements_reset introduced, still --- restricted for non-superusers. -AlTER EXTENSION pg_stat_statements UPDATE TO '1.7'; -SET SESSION AUTHORIZATION pg_read_all_stats; -SELECT pg_stat_statements_reset(); -ERROR: permission denied for function pg_stat_statements_reset -RESET SESSION AUTHORIZATION; -SELECT pg_get_functiondef('pg_stat_statements_reset'::regproc); - pg_get_functiondef --------------------------------------------------------------------------------------------------------------------------------- - CREATE OR REPLACE FUNCTION public.pg_stat_statements_reset(userid oid DEFAULT 0, dbid oid DEFAULT 0, queryid bigint DEFAULT 0)+ - RETURNS void + - LANGUAGE c + - PARALLEL SAFE STRICT + - AS '$libdir/pg_stat_statements', $function$pg_stat_statements_reset_1_7$function$ + - -(1 row) - -SELECT pg_stat_statements_reset(); - pg_stat_statements_reset --------------------------- - -(1 row) - -\d pg_stat_statements - View "public.pg_stat_statements" - Column | Type | Collation | Nullable | Default ----------------------+------------------+-----------+----------+--------- - userid | oid | | | - dbid | oid | | | - queryid | bigint | | | - query | text | | | - calls | bigint | | | - total_time | double precision | | | - min_time | double precision | | | - max_time | double precision | | | - mean_time | double precision | | | - stddev_time | double precision | | | - rows | bigint | | | - shared_blks_hit | bigint | | | - shared_blks_read | bigint | | | - shared_blks_dirtied | bigint | | | - shared_blks_written | bigint | | | - local_blks_hit | bigint | | | - local_blks_read | bigint | | | - local_blks_dirtied | bigint | | | - local_blks_written | bigint | | | - temp_blks_read | bigint | | | - temp_blks_written | bigint | | | - blk_read_time | double precision | | | - blk_write_time | double precision | | | - -SELECT count(*) > 0 AS has_data FROM pg_stat_statements; - has_data ----------- - t -(1 row) - --- New functions and views for pg_stat_statements in 1.8 -AlTER EXTENSION pg_stat_statements UPDATE TO '1.8'; -SELECT pg_get_functiondef('pg_stat_statements_reset'::regproc); - pg_get_functiondef --------------------------------------------------------------------------------------------------------------------------------- - CREATE OR REPLACE FUNCTION public.pg_stat_statements_reset(userid oid DEFAULT 0, dbid oid DEFAULT 0, queryid bigint DEFAULT 0)+ - RETURNS void + - LANGUAGE c + - PARALLEL SAFE STRICT + - AS '$libdir/pg_stat_statements', $function$pg_stat_statements_reset_1_7$function$ + - -(1 row) - -\d pg_stat_statements - View "public.pg_stat_statements" - Column | Type | Collation | Nullable | Default ----------------------+------------------+-----------+----------+--------- - userid | oid | | | - dbid | oid | | | - queryid | bigint | | | - query | text | | | - plans | bigint | | | - total_plan_time | double precision | | | - min_plan_time | double precision | | | - max_plan_time | double precision | | | - mean_plan_time | double precision | | | - stddev_plan_time | double precision | | | - calls | bigint | | | - total_exec_time | double precision | | | - min_exec_time | double precision | | | - max_exec_time | double precision | | | - mean_exec_time | double precision | | | - stddev_exec_time | double precision | | | - rows | bigint | | | - shared_blks_hit | bigint | | | - shared_blks_read | bigint | | | - shared_blks_dirtied | bigint | | | - shared_blks_written | bigint | | | - local_blks_hit | bigint | | | - local_blks_read | bigint | | | - local_blks_dirtied | bigint | | | - local_blks_written | bigint | | | - temp_blks_read | bigint | | | - temp_blks_written | bigint | | | - blk_read_time | double precision | | | - blk_write_time | double precision | | | - wal_records | bigint | | | - wal_fpi | bigint | | | - wal_bytes | numeric | | | - -SELECT count(*) > 0 AS has_data FROM pg_stat_statements; - has_data ----------- - t -(1 row) - --- New function pg_stat_statement_info, and new function --- and view for pg_stat_statements introduced in 1.9 -AlTER EXTENSION pg_stat_statements UPDATE TO '1.9'; -SELECT pg_get_functiondef('pg_stat_statements_info'::regproc); - pg_get_functiondef -------------------------------------------------------------------------------------------------------------------------- - CREATE OR REPLACE FUNCTION public.pg_stat_statements_info(OUT dealloc bigint, OUT stats_reset timestamp with time zone)+ - RETURNS record + - LANGUAGE c + - PARALLEL SAFE STRICT + - AS '$libdir/pg_stat_statements', $function$pg_stat_statements_info$function$ + - -(1 row) - -\d pg_stat_statements - View "public.pg_stat_statements" - Column | Type | Collation | Nullable | Default ----------------------+------------------+-----------+----------+--------- - userid | oid | | | - dbid | oid | | | - toplevel | boolean | | | - queryid | bigint | | | - query | text | | | - plans | bigint | | | - total_plan_time | double precision | | | - min_plan_time | double precision | | | - max_plan_time | double precision | | | - mean_plan_time | double precision | | | - stddev_plan_time | double precision | | | - calls | bigint | | | - total_exec_time | double precision | | | - min_exec_time | double precision | | | - max_exec_time | double precision | | | - mean_exec_time | double precision | | | - stddev_exec_time | double precision | | | - rows | bigint | | | - shared_blks_hit | bigint | | | - shared_blks_read | bigint | | | - shared_blks_dirtied | bigint | | | - shared_blks_written | bigint | | | - local_blks_hit | bigint | | | - local_blks_read | bigint | | | - local_blks_dirtied | bigint | | | - local_blks_written | bigint | | | - temp_blks_read | bigint | | | - temp_blks_written | bigint | | | - blk_read_time | double precision | | | - blk_write_time | double precision | | | - wal_records | bigint | | | - wal_fpi | bigint | | | - wal_bytes | numeric | | | - -SELECT count(*) > 0 AS has_data FROM pg_stat_statements; - has_data ----------- - t -(1 row) - --- New functions and views for pg_stat_statements in 1.10 -AlTER EXTENSION pg_stat_statements UPDATE TO '1.10'; -\d pg_stat_statements - View "public.pg_stat_statements" - Column | Type | Collation | Nullable | Default -------------------------+------------------+-----------+----------+--------- - userid | oid | | | - dbid | oid | | | - toplevel | boolean | | | - queryid | bigint | | | - query | text | | | - plans | bigint | | | - total_plan_time | double precision | | | - min_plan_time | double precision | | | - max_plan_time | double precision | | | - mean_plan_time | double precision | | | - stddev_plan_time | double precision | | | - calls | bigint | | | - total_exec_time | double precision | | | - min_exec_time | double precision | | | - max_exec_time | double precision | | | - mean_exec_time | double precision | | | - stddev_exec_time | double precision | | | - rows | bigint | | | - shared_blks_hit | bigint | | | - shared_blks_read | bigint | | | - shared_blks_dirtied | bigint | | | - shared_blks_written | bigint | | | - local_blks_hit | bigint | | | - local_blks_read | bigint | | | - local_blks_dirtied | bigint | | | - local_blks_written | bigint | | | - temp_blks_read | bigint | | | - temp_blks_written | bigint | | | - blk_read_time | double precision | | | - blk_write_time | double precision | | | - temp_blk_read_time | double precision | | | - temp_blk_write_time | double precision | | | - wal_records | bigint | | | - wal_fpi | bigint | | | - wal_bytes | numeric | | | - jit_functions | bigint | | | - jit_generation_time | double precision | | | - jit_inlining_count | bigint | | | - jit_inlining_time | double precision | | | - jit_optimization_count | bigint | | | - jit_optimization_time | double precision | | | - jit_emission_count | bigint | | | - jit_emission_time | double precision | | | - -SELECT count(*) > 0 AS has_data FROM pg_stat_statements; - has_data ----------- - t -(1 row) - --- New functions and views for pg_stat_statements in 1.11 -AlTER EXTENSION pg_stat_statements UPDATE TO '1.11'; -\d pg_stat_statements - View "public.pg_stat_statements" - Column | Type | Collation | Nullable | Default -------------------------+--------------------------+-----------+----------+--------- - userid | oid | | | - dbid | oid | | | - toplevel | boolean | | | - queryid | bigint | | | - query | text | | | - plans | bigint | | | - total_plan_time | double precision | | | - min_plan_time | double precision | | | - max_plan_time | double precision | | | - mean_plan_time | double precision | | | - stddev_plan_time | double precision | | | - calls | bigint | | | - total_exec_time | double precision | | | - min_exec_time | double precision | | | - max_exec_time | double precision | | | - mean_exec_time | double precision | | | - stddev_exec_time | double precision | | | - rows | bigint | | | - shared_blks_hit | bigint | | | - shared_blks_read | bigint | | | - shared_blks_dirtied | bigint | | | - shared_blks_written | bigint | | | - local_blks_hit | bigint | | | - local_blks_read | bigint | | | - local_blks_dirtied | bigint | | | - local_blks_written | bigint | | | - temp_blks_read | bigint | | | - temp_blks_written | bigint | | | - shared_blk_read_time | double precision | | | - shared_blk_write_time | double precision | | | - local_blk_read_time | double precision | | | - local_blk_write_time | double precision | | | - temp_blk_read_time | double precision | | | - temp_blk_write_time | double precision | | | - wal_records | bigint | | | - wal_fpi | bigint | | | - wal_bytes | numeric | | | - jit_functions | bigint | | | - jit_generation_time | double precision | | | - jit_inlining_count | bigint | | | - jit_inlining_time | double precision | | | - jit_optimization_count | bigint | | | - jit_optimization_time | double precision | | | - jit_emission_count | bigint | | | - jit_emission_time | double precision | | | - jit_deform_count | bigint | | | - jit_deform_time | double precision | | | - stats_since | timestamp with time zone | | | - minmax_stats_since | timestamp with time zone | | | - -SELECT count(*) > 0 AS has_data FROM pg_stat_statements; - has_data ----------- - t -(1 row) - --- New parameter minmax_only of pg_stat_statements_reset function -SELECT pg_get_functiondef('pg_stat_statements_reset'::regproc); - pg_get_functiondef -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - CREATE OR REPLACE FUNCTION public.pg_stat_statements_reset(userid oid DEFAULT 0, dbid oid DEFAULT 0, queryid bigint DEFAULT 0, minmax_only boolean DEFAULT false)+ - RETURNS timestamp with time zone + - LANGUAGE c + - PARALLEL SAFE STRICT + - AS '$libdir/pg_stat_statements', $function$pg_stat_statements_reset_1_11$function$ + - -(1 row) - -SELECT pg_stat_statements_reset() IS NOT NULL AS t; - t ---- - t -(1 row) - --- New functions and views for pg_stat_statements in 1.12 -AlTER EXTENSION pg_stat_statements UPDATE TO '1.12'; -\d pg_stat_statements - View "public.pg_stat_statements" - Column | Type | Collation | Nullable | Default -----------------------------+--------------------------+-----------+----------+--------- - userid | oid | | | - dbid | oid | | | - toplevel | boolean | | | - queryid | bigint | | | - query | text | | | - plans | bigint | | | - total_plan_time | double precision | | | - min_plan_time | double precision | | | - max_plan_time | double precision | | | - mean_plan_time | double precision | | | - stddev_plan_time | double precision | | | - calls | bigint | | | - total_exec_time | double precision | | | - min_exec_time | double precision | | | - max_exec_time | double precision | | | - mean_exec_time | double precision | | | - stddev_exec_time | double precision | | | - rows | bigint | | | - shared_blks_hit | bigint | | | - shared_blks_read | bigint | | | - shared_blks_dirtied | bigint | | | - shared_blks_written | bigint | | | - local_blks_hit | bigint | | | - local_blks_read | bigint | | | - local_blks_dirtied | bigint | | | - local_blks_written | bigint | | | - temp_blks_read | bigint | | | - temp_blks_written | bigint | | | - shared_blk_read_time | double precision | | | - shared_blk_write_time | double precision | | | - local_blk_read_time | double precision | | | - local_blk_write_time | double precision | | | - temp_blk_read_time | double precision | | | - temp_blk_write_time | double precision | | | - wal_records | bigint | | | - wal_fpi | bigint | | | - wal_bytes | numeric | | | - jit_functions | bigint | | | - jit_generation_time | double precision | | | - jit_inlining_count | bigint | | | - jit_inlining_time | double precision | | | - jit_optimization_count | bigint | | | - jit_optimization_time | double precision | | | - jit_emission_count | bigint | | | - jit_emission_time | double precision | | | - jit_deform_count | bigint | | | - jit_deform_time | double precision | | | - parallel_workers_to_launch | bigint | | | - parallel_workers_launched | bigint | | | - stats_since | timestamp with time zone | | | - minmax_stats_since | timestamp with time zone | | | - -SELECT count(*) > 0 AS has_data FROM pg_stat_statements; - has_data ----------- - t -(1 row) - -DROP EXTENSION pg_stat_statements; +psql: error: connection to server on socket "/tmp/pg_regress-p00GR5/.s.PGSQL.65312" failed: No such file or directory + Is the server running locally and accepting connections on that socket?