From dbd2ca43ba4d785e27655d3c51b5f001f6802c92 Mon Sep 17 00:00:00 2001 From: Ilya Staroverov Date: Mon, 26 Oct 2026 13:13:35 +0300 Subject: [PATCH v1 10/11] Include the operators of row comparisons in query jumbling RowCompareExpr.opnos, the operators of a row comparison, has not been part of the query ID since query jumbling was added to pg_stat_statements in 9.2, only the comparison type in RowCompareExpr.cmptype. But a row comparison can use the operators of any btree operator family, so queries comparing rows of text with < and with ~<~, which use different rules, were merged into a single pg_stat_statements entry. Include RowCompareExpr.opnos in query jumbling. The operator families and the input collations are still left out, as they are derived from the operators and the arguments. This changes the query IDs of the queries with row comparisons, so it is for master only. Author: Ilya Staroverov --- contrib/pg_stat_statements/expected/select.out | 5 +++-- src/include/nodes/primnodes.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/pg_stat_statements/expected/select.out b/contrib/pg_stat_statements/expected/select.out index 4ba573f019..56fddfa875 100644 --- a/contrib/pg_stat_statements/expected/select.out +++ b/contrib/pg_stat_statements/expected/select.out @@ -1283,11 +1283,12 @@ SELECT calls, query FROM pg_stat_statements ORDER BY query COLLATE "C"; 1 | SELECT (ROW($1, $2)::pgss_pair2).* 1 | SELECT ROW($1, $2) 1 | SELECT ROW($1, $2)::pgss_pair1 - 2 | SELECT ROW(s, t) < ROW($1, $2) FROM (VALUES ($3, $4)) AS v(s, t) + 1 | SELECT ROW(s, t) < ROW($1, $2) FROM (VALUES ($3, $4)) AS v(s, t) 1 | SELECT ROW(s, t) <= ROW($1, $2) FROM (VALUES ($3, $4)) AS v(s, t) + 1 | SELECT ROW(s, t) ~<~ ROW($1, $2) FROM (VALUES ($3, $4)) AS v(s, t) 0 | SELECT calls, query FROM pg_stat_statements ORDER BY query COLLATE "C" 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t -(8 rows) +(9 rows) DROP TYPE pgss_pair1, pgss_pair2; DROP TABLE pgss_empty_tab; diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index f13f75b22d..4aaf51be56 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -1483,7 +1483,7 @@ typedef struct RowCompareExpr /* LT LE GE or GT, never EQ or NE */ CompareType cmptype; /* OID list of pairwise comparison ops */ - List *opnos pg_node_attr(query_jumble_ignore); + List *opnos; /* OID list of containing operator families */ List *opfamilies pg_node_attr(query_jumble_ignore); /* OID list of collations for comparisons */ -- 2.43.0