Commit f2c27eb
liushengsong
Fix ORCA foreign scan crash with RTEPermissionInfo mismatch
BuildForeignScan() calls build_simple_rel() which looks up
RTEPermissionInfo via root->parse->rteperminfos using the RTE's
perminfoindex. When ORCA translates DXL back to a PlannedStmt, it
creates new RTEs with its own perminfoindex numbering, but passes
m_orig_query (the rewritten query) to BuildForeignScan. After the
rewriter expands external table ON SELECT rules into subqueries, the
outer query's rteperminfos shrinks, causing a mismatch: e.g.
perminfoindex=2 but rteperminfos has only 1 entry.
Fix by temporarily swapping m_orig_query->rteperminfos with ORCA's
own perminfos list around CreateForeignScan calls, so the indices
are consistent. This covers both static and dynamic foreign scans.1 parent 44bbe12 commit f2c27eb
1 file changed
+27
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
662 | 675 | | |
663 | 676 | | |
664 | | - | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
665 | 680 | | |
666 | 681 | | |
667 | 682 | | |
| |||
4611 | 4626 | | |
4612 | 4627 | | |
4613 | 4628 | | |
| 4629 | + | |
| 4630 | + | |
| 4631 | + | |
| 4632 | + | |
| 4633 | + | |
| 4634 | + | |
4614 | 4635 | | |
4615 | 4636 | | |
4616 | | - | |
| 4637 | + | |
4617 | 4638 | | |
4618 | 4639 | | |
4619 | 4640 | | |
| |||
4645 | 4666 | | |
4646 | 4667 | | |
4647 | 4668 | | |
4648 | | - | |
| 4669 | + | |
4649 | 4670 | | |
4650 | 4671 | | |
4651 | 4672 | | |
4652 | 4673 | | |
| 4674 | + | |
| 4675 | + | |
| 4676 | + | |
4653 | 4677 | | |
4654 | 4678 | | |
4655 | 4679 | | |
| |||
0 commit comments