forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit03107b4
committed
Ensure generated join clauses for child rels have correct relids.
When building a join clause derived from an EquivalenceClass, if theclause is to be used with an appendrel child relation then make sureits clause_relids include the relids of that child relation.Normally this would be true already because the EquivalenceMemberwould be a Var of that relation. However, if the appendrel representsa flattened UNION ALL construct then some child EquivalenceMemberscould be constants with no relids. The resulting under-marked clauseis problematic because it could mislead join_clause_is_movable_intoabout where the clause should be evaluated. We do not have an exampleshowing incorrect plan generation, but there are existing cases inthe regression tests that will fail the Asserts this patch adds toget_baserel_parampathinfo. A similarly wrong conclusion about aclause being considered by get_joinrel_parampathinfo would lead towrong placement of the clause. (This also squares with the waythat clause_relids is calculated for non-equijoin clauses inadjust_appendrel_attrs.)The other reason for wanting these new Asserts is that the previousblithe assumption that the results of generate_join_implied_equalities"necessarily satisfy join_clause_is_movable_into" turns out to bewrong pre-v16. If it's still wrong it'd be good to find out.Per bug #18429 from Benoît Ryder. The bug as filed was fixed bycommit2489d76, but these changes correlate with the fix wewill need to apply in pre-v16 branches.Discussion:https://postgr.es/m/18429-8982d4a348cc86c6@postgresql.org1 parentf698704 commit03107b4
2 files changed
+34
-7
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1896 | 1896 |
| |
1897 | 1897 |
| |
1898 | 1898 |
| |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
1899 | 1914 |
| |
1900 | 1915 |
| |
1901 | 1916 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1560 | 1560 |
| |
1561 | 1561 |
| |
1562 | 1562 |
| |
| 1563 | + | |
1563 | 1564 |
| |
1564 | 1565 |
| |
1565 | 1566 |
| |
| |||
1595 | 1596 |
| |
1596 | 1597 |
| |
1597 | 1598 |
| |
1598 |
| - | |
| 1599 | + | |
| 1600 | + | |
1599 | 1601 |
| |
1600 |
| - | |
1601 |
| - | |
1602 |
| - | |
1603 |
| - | |
1604 |
| - | |
1605 |
| - | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
1606 | 1618 |
| |
1607 | 1619 |
| |
1608 | 1620 |
| |
|
0 commit comments
Comments
(0)