- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit9b63c13
committed
Repair failure with SubPlans in multi-row VALUES lists.
When nodeValuesscan.c was written, it was impossible to have a SubPlan inVALUES --- any sub-SELECT there would have to be uncorrelated and therebywould produce an InitPlan instead. We therefore took a shortcut in thelogic that throws away a ValuesScan's per-row expression evaluation datastructures. This was broken by the introduction of LATERAL however; asub-SELECT containing a lateral reference produces a correlated SubPlan.The cleanest fix for this would be to give up the optimization ofdiscarding the expression eval state. But that still seems prettyunappetizing for long VALUES lists. It seems to work to just preventthe subexpressions from hooking into the ValuesScan node's subPlanlist, so let's do that and see how well it works. (If this breaks,due to additional connections between the subexpressions and the outerquery structures, we might consider compromises like throwing away dataonly for VALUES rows not containing SubPlans.)Per bug #14924 from Christian Duta. Back-patch to 9.3 where LATERALwas introduced.Discussion:https://postgr.es/m/20171124120836.1463.5310@wrigleys.postgresql.org1 parentab97aaa commit9b63c13
File tree
3 files changed
+56
-5
lines changed- src
- backend/executor
- test/regress
- expected
- sql
3 files changed
+56
-5
lines changedLines changed: 16 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
92 | 92 |
| |
93 | 93 |
| |
94 | 94 |
| |
| 95 | + | |
95 | 96 |
| |
96 | 97 |
| |
97 | 98 |
| |
| |||
114 | 115 |
| |
115 | 116 |
| |
116 | 117 |
| |
117 |
| - | |
118 |
| - | |
119 |
| - | |
120 |
| - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
121 | 127 |
| |
122 |
| - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
123 | 134 |
| |
124 | 135 |
| |
125 | 136 |
| |
|
Lines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
840 | 840 |
| |
841 | 841 |
| |
842 | 842 |
| |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
843 | 873 |
| |
844 | 874 |
| |
845 | 875 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
472 | 472 |
| |
473 | 473 |
| |
474 | 474 |
| |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
475 | 485 |
| |
476 | 486 |
| |
477 | 487 |
| |
|
0 commit comments
Comments
(0)