Doubled test for SET statements in pg_stat_statements tests

Started by Sergei Kornilovabout 2 years ago2 messages
1 attachment(s)

Hello!

I noticed that the same block

-- SET statements.
-- These use two different strings, still they count as one entry.
SET work_mem = '1MB';
Set work_mem = '1MB';
SET work_mem = '2MB';
RESET work_mem;
SET enable_seqscan = off;
SET enable_seqscan = on;
RESET enable_seqscan;

is checked twice in contrib/pg_stat_statements/sql/utility.sql on lines 278-286 and 333-341. Is this on any purpose? I think the second set of tests is not needed and can be removed, as in the attached patch.

regards, Sergei

Attachments:

pgss_doubled_test_for_set_statements.patchtext/x-diff; name=pgss_doubled_test_for_set_statements.patchDownload
diff --git a/contrib/pg_stat_statements/expected/utility.out b/contrib/pg_stat_statements/expected/utility.out
index cc6e898cdf..a913421290 100644
--- a/contrib/pg_stat_statements/expected/utility.out
+++ b/contrib/pg_stat_statements/expected/utility.out
@@ -664,30 +664,3 @@ SELECT pg_stat_statements_reset();
  
 (1 row)
 
--- SET statements.
--- These use two different strings, still they count as one entry.
-SET work_mem = '1MB';
-Set work_mem = '1MB';
-SET work_mem = '2MB';
-RESET work_mem;
-SET enable_seqscan = off;
-SET enable_seqscan = on;
-RESET enable_seqscan;
-SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
- calls | rows |               query               
--------+------+-----------------------------------
-     1 |    0 | RESET enable_seqscan
-     1 |    0 | RESET work_mem
-     1 |    1 | SELECT pg_stat_statements_reset()
-     1 |    0 | SET enable_seqscan = off
-     1 |    0 | SET enable_seqscan = on
-     2 |    0 | SET work_mem = '1MB'
-     1 |    0 | SET work_mem = '2MB'
-(7 rows)
-
-SELECT pg_stat_statements_reset();
- pg_stat_statements_reset 
---------------------------
- 
-(1 row)
-
diff --git a/contrib/pg_stat_statements/sql/utility.sql b/contrib/pg_stat_statements/sql/utility.sql
index 04598e5ae4..3fb8dde68e 100644
--- a/contrib/pg_stat_statements/sql/utility.sql
+++ b/contrib/pg_stat_statements/sql/utility.sql
@@ -329,16 +329,3 @@ DROP TABLE pgss_ctas;
 DROP TABLE pgss_select_into;
 
 SELECT pg_stat_statements_reset();
-
--- SET statements.
--- These use two different strings, still they count as one entry.
-SET work_mem = '1MB';
-Set work_mem = '1MB';
-SET work_mem = '2MB';
-RESET work_mem;
-SET enable_seqscan = off;
-SET enable_seqscan = on;
-RESET enable_seqscan;
-
-SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
-SELECT pg_stat_statements_reset();
#2Michael Paquier
michael@paquier.xyz
In reply to: Sergei Kornilov (#1)
Re: Doubled test for SET statements in pg_stat_statements tests

On Wed, Nov 08, 2023 at 10:33:23AM +0300, Sergei Kornilov wrote:

is checked twice in contrib/pg_stat_statements/sql/utility.sql on
lines 278-286 and 333-341. Is this on any purpose? I think the
second set of tests is not needed and can be removed, as in the
attached patch.

Thanks, applied. This looks like a copy-paste mistake coming from
de2aca288569, even if it has added more scenarios for patterns around
SET.
--
Michael