Skip to content

Commit

Permalink
Merge pull request #120 from darkfronza/PG-260_fix_regression_tests
Browse files Browse the repository at this point in the history
PG-260 fix regression tests
  • Loading branch information
ibrarahmad authored Oct 14, 2021
2 parents 0495909 + 9e76f6f commit 52ea543
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions pg_stat_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,11 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo,
if (tmp.state == PGSS_FINISHED)
continue;
}

/* Skip queries such as, $1, $2 := $3, etc. */
if (tmp.state == PGSS_PARSE || tmp.state == PGSS_PLAN)
continue;

if (tmp.info.parentid != UINT64CONST(0))
{
int len = 0;
Expand Down
2 changes: 1 addition & 1 deletion regression/expected/counters.out
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ end $$;
SELECT query,calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | calls
---------------------------------------------------------------------------------------------------+-------
SELECT a,b,c,d FROM t1, t2, t3, t4 WHERE t1.a = t2.b AND t3.c = t4.d ORDER BY a; | 1000
SELECT a,b,c,d FROM t1, t2, t3, t4 WHERE t1.a = t2.b AND t3.c = t4.d ORDER BY a | 1000
SELECT pg_stat_monitor_reset(); | 1
SELECT query,calls FROM pg_stat_monitor ORDER BY query COLLATE "C"; | 1
do $$ +| 1
Expand Down
2 changes: 1 addition & 1 deletion regression/expected/state.out
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ERROR: division by zero
SELECT query, state_code, state FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | state_code | state
----------------------------------------------------------------------------------+------------+---------------------
SELECT $1 AS num | 3 | FINISHED
SELECT $1 | 3 | FINISHED
SELECT 1/0; | 4 | FINISHED WITH ERROR
SELECT pg_stat_monitor_reset(); | 3 | FINISHED
SELECT query, state_code, state FROM pg_stat_monitor ORDER BY query COLLATE "C"; | 2 | ACTIVE
Expand Down
10 changes: 5 additions & 5 deletions regression/expected/tags.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ SELECT 1 AS num /* { "application", psql_app, "real_ip", 192.168.1.3) */;
(1 row)

SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | comments
-------------------------------------------------------------------------+------------------------------------------------------
SELECT $1 AS num | { "application", psql_app, "real_ip", 192.168.1.3)
SELECT pg_stat_monitor_reset(); |
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C"; |
query | comments
---------------------------------------------------------------------------+------------------------------------------------------
SELECT $1 AS num /* { "application", psql_app, "real_ip", 192.168.1.3) */ | { "application", psql_app, "real_ip", 192.168.1.3)
SELECT pg_stat_monitor_reset(); |
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C"; |
(3 rows)

SELECT pg_stat_monitor_reset();
Expand Down

0 comments on commit 52ea543

Please sign in to comment.