From 0e06a4c701f2bdbefe8ffa8386b004de6d0b8fdd Mon Sep 17 00:00:00 2001 From: Diego Fronza Date: Thu, 14 Oct 2021 10:24:41 -0300 Subject: [PATCH] PG-260: Fix display of queries in pg_stat_monitor view. Don't display queries in PARSE or PLAN state, to keep it consistent with previous behavior, this avoids showing intermediate scripts like part of a procedure, such as: $1 $1 := $3 --- pg_stat_monitor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pg_stat_monitor.c b/pg_stat_monitor.c index ee63ba7..2f51c08 100644 --- a/pg_stat_monitor.c +++ b/pg_stat_monitor.c @@ -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;