forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitbdd9a99
committed
Propagate lateral-reference information to indirect descendant relations.
create_lateral_join_info() computes a bunch of information about lateralreferences between base relations, and then attempts to propagate thosemarkings to appendrel children of the original base relations. But theoriginal coding neglected the possibility of indirect descendants(grandchildren etc). During v11 development we noticed that this waswrong for partitioned-table cases, but failed to realize that it was justas wrong for any appendrel. While the case can't arise for appendrelsderived from traditional table inheritance (because we make a flatappendrel for that), nested appendrels can arise from nested UNION ALLsubqueries. Failure to mark the lower-level relations as having lateralreferences leads to confusion in add_paths_to_append_rel about whetherunparameterized paths can be built. It's not very clear whether thatleads to any user-visible misbehavior; the lack of field reports suggeststhat it may cause nothing worse than minor cost misestimation. Still,it's a bug, and it leads to failures of Asserts that I intend to addlater.To fix, we need to propagate information from all appendrel parents,not just those that are RELOPT_BASERELs. We can still do it in onepass, if we rely on the append_rel_list to be ordered with ancestorrelationships before descendant ones; add assertions checking that.While fixing this, we can make a small performance improvement bytraversing the append_rel_list just once instead of separately foreach appendrel parent relation.Noted while investigating bug #15613, though this patch does not fixthat (which is why I'm not committing the related Asserts yet).Discussion:https://postgr.es/m/3951.1549403812@sss.pgh.pa.us1 parent592123e commitbdd9a99
1 file changed
+31
-40
lines changedLines changed: 31 additions & 40 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
419 | 419 |
| |
420 | 420 |
| |
421 | 421 |
| |
| 422 | + | |
422 | 423 |
| |
423 | 424 |
| |
424 | 425 |
| |
| |||
627 | 628 |
| |
628 | 629 |
| |
629 | 630 |
| |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
630 | 638 |
| |
631 |
| - | |
| 639 | + | |
632 | 640 |
| |
633 |
| - | |
634 |
| - | |
635 |
| - | |
636 |
| - | |
637 |
| - | |
638 |
| - | |
639 |
| - | |
640 |
| - | |
641 |
| - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
642 | 644 |
| |
643 | 645 |
| |
644 |
| - | |
645 |
| - | |
646 |
| - | |
647 |
| - | |
648 |
| - | |
649 |
| - | |
650 |
| - | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
651 | 650 |
| |
652 |
| - | |
653 |
| - | |
654 |
| - | |
655 |
| - | |
| 651 | + | |
656 | 652 |
| |
657 | 653 |
| |
658 |
| - | |
659 |
| - | |
660 |
| - | |
661 |
| - | |
662 |
| - | |
663 |
| - | |
664 |
| - | |
665 |
| - | |
666 |
| - | |
667 |
| - | |
668 |
| - | |
669 |
| - | |
670 |
| - | |
671 |
| - | |
672 |
| - | |
673 |
| - | |
674 |
| - | |
675 |
| - | |
676 |
| - | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
677 | 668 |
| |
678 | 669 |
| |
679 | 670 |
| |
|
0 commit comments
Comments
(0)