forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita6897ef
committed
Fix overeager pushdown of HAVING clauses when grouping sets are used.
In61444bf we started to allow HAVING clauses to be fully pushed downinto WHERE, even when grouping sets are in use. That turns out not towork correctly, because grouping sets can "produce" NULLs, meaning thatfiltering in WHERE and HAVING can have different results, even when noaggregates or volatile functions are involved.Instead only allow pushdown of empty grouping sets.It'd be nice to do better, but the exact mechanics of deciding whichcases are safe are still being debated. It's important to give correctresults till we find a good solution, and such a solution might not beappropriate for backpatching anyway.Bug: #13863Reported-By: 'wrb'Diagnosed-By: Dean RasheedAuthor: Andrew GierthReviewed-By: Dean Rasheed and Andres FreundDiscussion: 20160113183558.12989.56904@wrigleys.postgresql.orgBackpatch: 9.5, where grouping sets were introduced1 parentc477e84 commita6897ef
File tree
3 files changed
+81
-8
lines changed- src
- backend/optimizer/plan
- test/regress
- expected
- sql
3 files changed
+81
-8
lines changedLines changed: 15 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
653 | 653 |
| |
654 | 654 |
| |
655 | 655 |
| |
656 |
| - | |
657 |
| - | |
658 |
| - | |
659 |
| - | |
660 |
| - | |
661 |
| - | |
662 |
| - | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
663 | 669 |
| |
664 | 670 |
| |
665 | 671 |
| |
| |||
679 | 685 |
| |
680 | 686 |
| |
681 | 687 |
| |
682 |
| - | |
| 688 | + | |
| 689 | + | |
683 | 690 |
| |
684 | 691 |
| |
685 | 692 |
| |
|
Lines changed: 54 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
607 | 607 |
| |
608 | 608 |
| |
609 | 609 |
| |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
610 | 664 |
| |
611 | 665 |
| |
612 | 666 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
183 | 183 |
| |
184 | 184 |
| |
185 | 185 |
| |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
186 | 198 |
| |
187 | 199 |
| |
188 | 200 |
| |
|
0 commit comments
Comments
(0)