forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitdb9f0e1
committed
Postpone creation of pathkeys lists to fix bug #8049.
This patch gets rid of the concept of, and infrastructure for,non-canonical PathKeys; we now only ever create canonical pathkey lists.The need for non-canonical pathkeys came from the desire to havegrouping_planner initialize query_pathkeys and related pathkey lists beforecalling query_planner. However, since query_planner didn't actually *do*anything with those lists before they'd been made canonical, we can get ridof the whole mess by just not creating the lists at all until the pointwhere we formerly canonicalized them.There are several ways in which we could implement that without makingquery_planner itself deal with grouping/sorting features (which aresupposed to be the province of grouping_planner). I chose to add acallback function to query_planner's API; other alternatives would haverequired adding more fields to PlannerInfo, which while not bad in itselfwould create an ABI break for planner-related plugins in the 9.2 releaseseries. This still breaks ABI for anything that calls query_plannerdirectly, but it seems somewhat unlikely that there are any such plugins.I had originally conceived of this change as merely a step on the way tofixing bug #8049 from Teun Hoogendoorn; but it turns out that this fixesthat bug all by itself, as per the added regression test. The reason isthat now get_eclass_for_sort_expr is adding the ORDER BY expression at theend of EquivalenceClass creation not the start, and so anything that is ina multi-member EquivalenceClass has already been created with correctem_nullable_relids. I am suspicious that there are related scenarios inwhich we still need to teach get_eclass_for_sort_expr to compute correctnullable_relids, but am not eager to risk destabilizing either 9.2 or 9.3to fix bugs that are only hypothetical. So for the moment, do this andstop here.Back-patch to 9.2 but not to earlier branches, since they don't exhibitthis bug for lack of join-clause-movement logic that depends onem_nullable_relids being correct. (We might have to revisit that choiceif any related bugs turn up.) In 9.2, don't change the signature ofmake_pathkeys_for_sortclauses nor remove canonicalize_pathkeys, so asnot to risk more plugin breakage than we have to.1 parent5fc8937 commitdb9f0e1
File tree
12 files changed
+246
-314
lines changed- src
- backend
- nodes
- optimizer
- path
- plan
- include
- nodes
- optimizer
- test/regress
- expected
- sql
12 files changed
+246
-314
lines changedLines changed: 2 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
728 | 728 |
| |
729 | 729 |
| |
730 | 730 |
| |
731 |
| - | |
732 |
| - | |
733 |
| - | |
734 |
| - | |
735 |
| - | |
736 |
| - | |
737 |
| - | |
738 |
| - | |
739 |
| - | |
740 |
| - | |
741 |
| - | |
742 |
| - | |
743 |
| - | |
744 |
| - | |
745 |
| - | |
746 |
| - | |
| 731 | + | |
| 732 | + | |
747 | 733 |
| |
748 | 734 |
| |
749 | 735 |
| |
|
Lines changed: 5 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
589 | 589 |
| |
590 | 590 |
| |
591 | 591 |
| |
592 |
| - | |
593 |
| - | |
594 |
| - | |
595 |
| - | |
596 |
| - | |
597 |
| - | |
598 |
| - | |
599 |
| - | |
600 |
| - | |
601 |
| - | |
602 | 592 |
| |
603 | 593 |
| |
604 | 594 |
| |
| |||
651 | 641 |
| |
652 | 642 |
| |
653 | 643 |
| |
654 |
| - | |
655 |
| - | |
656 |
| - | |
657 |
| - | |
658 |
| - | |
659 |
| - | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
660 | 649 |
| |
661 | 650 |
| |
662 | 651 |
| |
|
Lines changed: 13 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
285 | 285 |
| |
286 | 286 |
| |
287 | 287 |
| |
288 |
| - | |
289 |
| - | |
290 |
| - | |
291 |
| - | |
292 |
| - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
293 | 301 |
| |
294 | 302 |
| |
295 | 303 |
| |
|
0 commit comments
Comments
(0)