1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Update query_id computation

Properly fix:

- the "ONLY" in FROM [ONLY] isn't hashed
- the agglevelsup field in GROUPING isn't hashed
- WITH TIES not being hashed (new in PG 13)
- "DISTINCT" in "GROUP BY [DISTINCT]" isn't hashed (new in PG 14)

Reported-by: Julien Rouhaud

Discussion: https://postgr.es/m/20210425081119.ulyzxqz23ueh3wuj@nol
This commit is contained in:
Bruce Momjian
2021-05-03 14:59:30 -04:00
parent 5df6aeab42
commit f7a97b6ec3
3 changed files with 207 additions and 0 deletions

View File

@ -230,6 +230,7 @@ JumbleQueryInternal(JumbleState *jstate, Query *query)
JumbleExpr(jstate, (Node *) query->onConflict);
JumbleExpr(jstate, (Node *) query->returningList);
JumbleExpr(jstate, (Node *) query->groupClause);
APP_JUMB(query->groupDistinct);
JumbleExpr(jstate, (Node *) query->groupingSets);
JumbleExpr(jstate, query->havingQual);
JumbleExpr(jstate, (Node *) query->windowClause);
@ -237,6 +238,7 @@ JumbleQueryInternal(JumbleState *jstate, Query *query)
JumbleExpr(jstate, (Node *) query->sortClause);
JumbleExpr(jstate, query->limitOffset);
JumbleExpr(jstate, query->limitCount);
APP_JUMB(query->limitOption);
JumbleRowMarks(jstate, query->rowMarks);
JumbleExpr(jstate, query->setOperations);
}
@ -259,6 +261,7 @@ JumbleRangeTable(JumbleState *jstate, List *rtable)
case RTE_RELATION:
APP_JUMB(rte->relid);
JumbleExpr(jstate, (Node *) rte->tablesample);
APP_JUMB(rte->inh);
break;
case RTE_SUBQUERY:
JumbleQueryInternal(jstate, rte->subquery);
@ -399,6 +402,7 @@ JumbleExpr(JumbleState *jstate, Node *node)
GroupingFunc *grpnode = (GroupingFunc *) node;
JumbleExpr(jstate, (Node *) grpnode->refs);
APP_JUMB(grpnode->agglevelsup);
}
break;
case T_WindowFunc: