forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit477023e
committed
Fix some more problems with nested append relations.
As of commita87c729 (which later got backpatched as far as 9.1),we're explicitly supporting the notion that append relations can benested; this can occur when UNION ALL constructs are nested, or whena UNION ALL contains a table with inheritance children.Bug #11457 from Nelson Page, as well as an earlier report from ElvisPranskevichus, showed that there were still nasty bugs associated with suchcases: in particular the EquivalenceClass mechanism could try to generate"join" clauses connecting an appendrel child to some grandparent appendrel,which would result in assertion failures or bogus plans.Upon investigation I concluded that all current callers offind_childrel_appendrelinfo() need to be fixed to explicitly considermultiple levels of parent appendrels. The most complex fix was inprocessing of "broken" EquivalenceClasses, which are ECs for which we havebeen unable to generate all the derived equality clauses we would like tobecause of missing cross-type equality operators in the underlying btreeoperator family. That code path is more or less entirely untested bythe regression tests to date, because no standard opfamilies have suchholes in them. So I wrote a new regression test script to try to exerciseit a bit, which turned out to be quite a worthwhile activity as it exposedexisting bugs in all supported branches.The present patch is essentially the same as far back as 9.2, which iswhere parameterized paths were introduced. In 9.0 and 9.1, we only needto back-patch a small fragment of commit5b7b551, which fixes failure topropagate out the original WHERE clauses when a broken EC contains constantmembers. (The regression test case results show that these older branchesare noticeably stupider than 9.2+ in terms of the quality of the plansgenerated; but we don't really care about plan quality in such cases,only that the plan not be outright wrong. A more invasive fix in theolder branches would not be a good idea anyway from a plan-stabilitystandpoint.)1 parentd1844c2 commit477023e
File tree
5 files changed
+619
-3
lines changed- src
- backend/optimizer/path
- test/regress
- expected
- sql
5 files changed
+619
-3
lines changedLines changed: 8 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
902 | 902 |
| |
903 | 903 |
| |
904 | 904 |
| |
905 |
| - | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
906 | 911 |
| |
907 | 912 |
| |
908 | 913 |
| |
| |||
914 | 919 |
| |
915 | 920 |
| |
916 | 921 |
| |
917 |
| - | |
| 922 | + | |
| 923 | + | |
918 | 924 |
| |
919 | 925 |
| |
920 | 926 |
| |
|
0 commit comments
Comments
(0)