forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit896eb5e
committed
In the planner, delete joinaliasvars lists after we're done with them.
Although joinaliasvars lists coming out of the parser are quite simple,those lists can contain arbitrarily complex expressions after subquerypullup. We do not perform expression preprocessing on them, meaning thatexpressions in those lists will not meet the expectations of later phasesof the planner (for example, that they do not contain SubLinks). This hadbeen thought pretty harmless, since we don't intentionally touch thoselists in later phases --- but Andreas Seltenreich found a case in whichadjust_appendrel_attrs() could recurse into a joinaliasvars list and thendie on its assertion that it never sees a SubLink. We considered a coupleof localized fixes to prevent that specific case from looking at thejoinaliasvars lists, but really this seems like a generic hazard for allexpression processing in the planner. Therefore, probably the best answeris to delete the joinaliasvars lists from the parsetree at the end ofexpression preprocessing, so that there are no reachable expressions thathaven't been through preprocessing.The case Andreas found seems to be harmless in non-Assert builds, and sofar there are no field reports suggesting that there are user-visibleeffects in other cases. I considered back-patching this anyway, butit turns out that Andreas' test doesn't fail at all in 9.4-9.6, becausein those versions adjust_appendrel_attrs contains code (added in commit842faa7 and removed again in commit215b43c) to process SubLinksrather than complain about them. Barring discovery of another path bywhich unprocessed joinaliasvars lists can cause trouble, the mostprudent compromise seems to be to patch this into v10 but not further.Patch by me, with thanks to Amit Langote for initial investigationand review.Discussion:https://postgr.es/m/87r2tvt9f1.fsf@ansel.ydns.eu1 parenta32c092 commit896eb5e
File tree
3 files changed
+59
-5
lines changed- src
- backend/optimizer/plan
- test/regress
- expected
- sql
3 files changed
+59
-5
lines changedLines changed: 27 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
776 | 776 |
| |
777 | 777 |
| |
778 | 778 |
| |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
779 | 800 |
| |
780 | 801 |
| |
781 | 802 |
| |
| |||
902 | 923 |
| |
903 | 924 |
| |
904 | 925 |
| |
905 |
| - | |
906 |
| - | |
907 |
| - | |
908 |
| - | |
909 |
| - | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
910 | 932 |
| |
911 | 933 |
| |
912 | 934 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
678 | 678 |
| |
679 | 679 |
| |
680 | 680 |
| |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
681 | 695 |
| |
682 | 696 |
| |
683 | 697 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
376 | 376 |
| |
377 | 377 |
| |
378 | 378 |
| |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
379 | 397 |
| |
380 | 398 |
| |
381 | 399 |
| |
|
0 commit comments
Comments
(0)