forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita742ecf
committed
Cope with lateral references in the quals of a subquery RTE.
The qual pushdown logic assumed that all Vars in a restriction clausemust be Vars referencing subquery outputs; but since we introducedLATERAL, it's possible for such a Var to be a lateral reference instead.This led to an assertion failure in debug builds. In a non-debugbuild, there might be no ill effects (if qual_is_pushdown_safe decidedthe qual was unsafe anyway), or we could get failures later due toconstruction of an invalid plan. I've not gone to much length tocharacterize the possible failures, but at least segfaults in theexecutor have been observed.Given that this has been busted since 9.3 and it took this long foranybody to notice, I judge that the case isn't worth going to greatlengths to optimize. Hence, fix by just teaching qual_is_pushdown_safethat such quals are unsafe to push down, matching the previous behaviorwhen it accidentally didn't fail.Per report from Tom Ellis. Back-patch to all supported branches.Discussion:https://postgr.es/m/20200713175124.GQ8220@cloudinit-builder1 parentb5b4c0f commita742ecf
File tree
3 files changed
+96
-3
lines changed- src
- backend/optimizer/path
- test/regress
- expected
- sql
3 files changed
+96
-3
lines changedLines changed: 17 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3508 | 3508 |
| |
3509 | 3509 |
| |
3510 | 3510 |
| |
3511 |
| - | |
3512 |
| - | |
| 3511 | + | |
| 3512 | + | |
| 3513 | + | |
| 3514 | + | |
3513 | 3515 |
| |
3514 | 3516 |
| |
3515 | 3517 |
| |
| |||
3529 | 3531 |
| |
3530 | 3532 |
| |
3531 | 3533 |
| |
3532 |
| - | |
| 3534 | + | |
| 3535 | + | |
| 3536 | + | |
| 3537 | + | |
| 3538 | + | |
| 3539 | + | |
| 3540 | + | |
| 3541 | + | |
| 3542 | + | |
| 3543 | + | |
| 3544 | + | |
| 3545 | + | |
| 3546 | + | |
3533 | 3547 |
| |
3534 | 3548 |
| |
3535 | 3549 |
| |
|
Lines changed: 53 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1159 | 1159 |
| |
1160 | 1160 |
| |
1161 | 1161 |
| |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
1162 | 1215 |
| |
1163 | 1216 |
| |
1164 | 1217 |
| |
|
Lines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
627 | 627 |
| |
628 | 628 |
| |
629 | 629 |
| |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
630 | 656 |
| |
631 | 657 |
| |
632 | 658 |
| |
|
0 commit comments
Comments
(0)