Skip to content

Commit

Permalink
Updated pgsm_query_id regression tests
Browse files Browse the repository at this point in the history
With the query dernomalization feature, having integer literals used in
sql like 1, or 2 could create some confusion on whether those are
placeholders or constant values, thus this commit updates the
pgsm_query_id regression test to use different integer literals to avoid
confusion.
  • Loading branch information
darkfronza committed Aug 15, 2024
1 parent f871606 commit f8d5474
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions regression/expected/pgsm_query_id.out
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SELECT * FROM t1;
---
(0 rows)

SELECT *, ADD(1, 2) FROM t1;
SELECT *, ADD(1234, 1000) FROM t1;
a | add
---+-----
(0 rows)
Expand Down Expand Up @@ -62,7 +62,7 @@ SELECT * FROM t1;
---
(0 rows)

SELECT *, ADD(1, 2) FROM t1;
SELECT *, ADD(1234, 1000) FROM t1;
a | add
---+-----
(0 rows)
Expand All @@ -87,12 +87,12 @@ SELECT datname, pgsm_query_id, query, calls FROM pg_stat_monitor ORDER BY pgsm_q
db1 | 1897482803466821995 | SELECT * FROM t2 | 3
db1 | 1988437669671417938 | SELECT * FROM t1 | 1
db2 | 1988437669671417938 | SELECT * FROM t1 | 1
db1 | 2864453209316739369 | select 1 + 2 | 1
db2 | 2864453209316739369 | select 1 + 2 | 1
db1 | 2864453209316739369 | select 1234 + 1000 | 1
db2 | 2864453209316739369 | select 1234 + 1000 | 1
db2 | 6220142855706866455 | set pg_stat_monitor.pgsm_enable_pgsm_query_id = on | 1
db2 | 6633979598391393345 | SELECT * FROM t3 where c = 20 | 1
db1 | 8140395000078788481 | SELECT *, ADD(1, 2) FROM t1 | 1
db2 | 8140395000078788481 | SELECT *, ADD(1, 2) FROM t1 | 1
db1 | 8140395000078788481 | SELECT *, ADD(1234, 1000) FROM t1 | 1
db2 | 8140395000078788481 | SELECT *, ADD(1234, 1000) FROM t1 | 1
db2 | | SELECT * FROM t3 | 1
db2 | | set pg_stat_monitor.pgsm_enable_pgsm_query_id = off | 1
(12 rows)
Expand Down
6 changes: 3 additions & 3 deletions regression/expected/pgsm_query_id_1.out
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ SELECT * FROM t1;
---
(0 rows)

SELECT *, ADD(1, 2) FROM t1;
SELECT *, ADD(1234, 1000) FROM t1;
a | add
---+-----
(0 rows)
Expand All @@ -89,8 +89,8 @@ SELECT datname, pgsm_query_id, query, calls FROM pg_stat_monitor ORDER BY pgsm_q
db2 | 1988437669671417938 | SELECT * FROM t1 | 1
db2 | 6220142855706866455 | set pg_stat_monitor.pgsm_enable_pgsm_query_id = on | 1
db2 | 6633979598391393345 | SELECT * FROM t3 where c = 20 | 1
db1 | 8140395000078788481 | SELECT *, ADD(1, 2) FROM t1 | 1
db2 | 8140395000078788481 | SELECT *, ADD(1, 2) FROM t1 | 1
db1 | 8140395000078788481 | SELECT *, ADD(1234, 1000) FROM t1 | 1
db2 | 8140395000078788481 | SELECT *, ADD(1234, 1000) FROM t1 | 1
db2 | | SELECT * FROM t3 | 1
db2 | | set pg_stat_monitor.pgsm_enable_pgsm_query_id = off | 1
(10 rows)
Expand Down
4 changes: 2 additions & 2 deletions regression/sql/pgsm_query_id.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CREATE FUNCTION add(integer, integer) RETURNS integer
SELECT pg_stat_monitor_reset();
\c db1
SELECT * FROM t1;
SELECT *, ADD(1, 2) FROM t1;
SELECT *, ADD(1234, 1000) FROM t1;
SELECT * FROM t2;
-- Check that spaces and comments do not generate a different pgsm_query_id
SELECT * FROM t2 --WHATEVER;
Expand All @@ -40,7 +40,7 @@ More comments to check for spaces.

\c db2
SELECT * FROM t1;
SELECT *, ADD(1, 2) FROM t1;
SELECT *, ADD(1234, 1000) FROM t1;

set pg_stat_monitor.pgsm_enable_pgsm_query_id = off;
SELECT * FROM t3;
Expand Down

0 comments on commit f8d5474

Please sign in to comment.