aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeHash.c
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2024-01-06 14:09:39 +0200
committerAlexander Korotkov <akorotkov@postgresql.org>2024-01-06 14:10:00 +0200
commit5ef34a8fc3899a306fbc907a762fee0ba3782462 (patch)
treed4002b3e7d1c69c37f2d1c89f68bd3c814fc077e /src/backend/executor/nodeHash.c
parent43b46aae12b220b7eca8250c6c361083f35985a0 (diff)
downloadpostgresql-5ef34a8fc3899a306fbc907a762fee0ba3782462.tar.gz
postgresql-5ef34a8fc3899a306fbc907a762fee0ba3782462.zip
Fix the issue that SJE mistakenly omits qual clauses
When the SJE code handles the transfer of qual clauses from the removed relation to the remaining one, it replaces the Vars of the removed relation with the Vars of the remaining relation for each clause, and then reintegrates these clauses into the appropriate restriction or join clause lists, while attempting to avoid duplicates. However, the code compares RestrictInfo->clause to determine if two clauses are duplicates. This is just flat wrong. Two RestrictInfos with the same clause can have different required_relids, incompatible_relids, is_pushed_down, and so on. This can cause qual clauses to be mistakenly omitted, leading to wrong results. This patch fixes it by comparing the entire RestrictInfos not just their clauses ignoring 'rinfo_serial' field (otherwise almost all RestrictInfos will be unique). Making 'rinfo_serial' equal_ignore would break other code. This is why this commit implements our own comparison function for checking the equality of RestrictInfos. Reported-by: Zuming Jiang Bug: #18261 Discussion: https://postgr.es/m/18261-2a75d748c928609b%40postgresql.org Author: Richard Guo
Diffstat (limited to 'src/backend/executor/nodeHash.c')
0 files changed, 0 insertions, 0 deletions