- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit4539262
committed
Fix hash join when inner hashkey expressions contain Params.
If the inner-side expressions contain PARAM_EXEC Params, we mustre-hash whenever the values of those Params change. The executormechanism for that exists already, but we failed to invoke it becausefinalize_plan() neglected to search the Hash.hashkeys field forParams. This allowed a previous scan's hash table to be re-usedwhen it should not be, leading to rows missing from the join's output.(I believe incorrectly-included join rows are impossible however,since checking the real hashclauses would reject false matches.)This bug is very ancient, dating probably tod24d75f of 7.4.Sadly, this simple fix depends on the plan representational changesmade by2abd7ae, so it will only work back to v12. I thoughtabout trying to make some kind of hack for v11, but I'm leeryof putting code significantly different from what is used in thenewer branches into a nearly-EOL branch. Seeing that the bugescaped detection for a full twenty years, problematic casesmust be rare; so I don't feel too awful about leaving v11 as-is.Per bug #17985 from Zuming Jiang. Back-patch to v12.Discussion:https://postgr.es/m/17985-748b66607acd432e@postgresql.org1 parent8a300fc commit4539262
File tree
3 files changed
+60
-1
lines changed- src
- backend/optimizer/plan
- test/regress
- expected
- sql
3 files changed
+60
-1
lines changedLines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2648 | 2648 |
| |
2649 | 2649 |
| |
2650 | 2650 |
| |
| 2651 | + | |
| 2652 | + | |
| 2653 | + | |
| 2654 | + | |
| 2655 | + | |
2651 | 2656 |
| |
2652 | 2657 |
| |
2653 | 2658 |
| |
| |||
2748 | 2753 |
| |
2749 | 2754 |
| |
2750 | 2755 |
| |
2751 |
| - | |
2752 | 2756 |
| |
2753 | 2757 |
| |
2754 | 2758 |
| |
|
Lines changed: 36 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1128 | 1128 |
| |
1129 | 1129 |
| |
1130 | 1130 |
| |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + |
Lines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
604 | 604 |
| |
605 | 605 |
| |
606 | 606 |
| |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + |
0 commit comments
Comments
(0)