From 15c73407c3b8394e413fbd0e66e09ee310a86388 Mon Sep 17 00:00:00 2001 From: Ibrar Ahmed Date: Wed, 22 Jun 2022 11:53:42 +0500 Subject: [PATCH] =?UTF-8?q?PG-453:=20Normalize=20query=20does=20not=20work?= =?UTF-8?q?=20with=20INSERT=20statements.=20=C2=A0=20=C2=A0=20=C2=A0=20?= =?UTF-8?q?=C2=A0=E2=80=A6=20(#268)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PG-453: Normalize query does not work with INSERT statements.                   The commit fixes the issue similar to pg_stat_statements. Jumble query skips in     case of INSERT statements to avoid the duplicate queryid, but in another       commit we already solved that problem with another way.     --- pg_stat_monitor.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pg_stat_monitor.c b/pg_stat_monitor.c index 8bb74bf..15e2bb9 100644 --- a/pg_stat_monitor.c +++ b/pg_stat_monitor.c @@ -2227,17 +2227,8 @@ JumbleQuery(JumbleState *jstate, Query *query) JumbleExpr(jstate, (Node *) query->cteList); JumbleRangeTable(jstate, query->rtable, query->commandType); - - /* - * Skip jointree and targetlist in case of insert statment - * to avoid queryid duplication problem. - */ - if (query->commandType != CMD_INSERT) - { - JumbleExpr(jstate, (Node *) query->jointree); - JumbleExpr(jstate, (Node *) query->targetList); - } - + JumbleExpr(jstate, (Node *) query->jointree); + JumbleExpr(jstate, (Node *) query->targetList); JumbleExpr(jstate, (Node *) query->onConflict); JumbleExpr(jstate, (Node *) query->returningList); JumbleExpr(jstate, (Node *) query->groupClause);