forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb81d069
committed
Change post-rewriter representation of dropped columns in joinaliasvars.
It's possible to drop a column from an input table of a JOIN clause in aview, if that column is nowhere actually referenced in the view. But itwill still be there in the JOIN clause's joinaliasvars list. We used toreplace such entries with NULL Const nodes, which is handy for generationof RowExpr expansion of a whole-row reference to the view. The troublewith that is that it can't be distinguished from the situation aftersubquery pull-up of a constant subquery output expression below the JOIN.Instead, replace such joinaliasvars with null pointers (empty expressiontrees), which can't be confused with pulled-up expressions. expandRTE()still emits the old convention, though, for convenience of RowExprgeneration and to reduce the risk of breaking extension code.In HEAD and 9.3, this patch also fixes a problem with some new code inruleutils.c that was failing to cope with implicitly-casted joinaliasvarsentries, as per recent report from Feike Steenbergen. That oversight wasbecause of an inadequate description of the data structure in parsenodes.h,which I've now corrected. There were some pre-existing oversights of thesame ilk elsewhere, which I believe are now all fixed.1 parent5712eeb commitb81d069
File tree
8 files changed
+119
-51
lines changed- src
- backend
- optimizer/util
- parser
- rewrite
- utils/adt
- include/nodes
- test/regress
- expected
- sql
8 files changed
+119
-51
lines changedLines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
654 | 654 |
| |
655 | 655 |
| |
656 | 656 |
| |
657 |
| - | |
| 657 | + | |
658 | 658 |
| |
659 | 659 |
| |
660 | 660 |
| |
| |||
687 | 687 |
| |
688 | 688 |
| |
689 | 689 |
| |
| 690 | + | |
690 | 691 |
| |
691 | 692 |
| |
692 | 693 |
| |
|
Lines changed: 20 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
| 27 | + | |
27 | 28 |
| |
28 | 29 |
| |
29 | 30 |
| |
| |||
749 | 750 |
| |
750 | 751 |
| |
751 | 752 |
| |
752 |
| - | |
753 |
| - | |
| 753 | + | |
| 754 | + | |
754 | 755 |
| |
755 | 756 |
| |
756 | 757 |
| |
757 | 758 |
| |
758 | 759 |
| |
759 |
| - | |
| 760 | + | |
| 761 | + | |
760 | 762 |
| |
761 | 763 |
| |
762 | 764 |
| |
| |||
1841 | 1843 |
| |
1842 | 1844 |
| |
1843 | 1845 |
| |
1844 |
| - | |
1845 |
| - | |
| 1846 | + | |
| 1847 | + | |
1846 | 1848 |
| |
1847 |
| - | |
| 1849 | + | |
1848 | 1850 |
| |
1849 | 1851 |
| |
1850 | 1852 |
| |
1851 | 1853 |
| |
1852 | 1854 |
| |
1853 | 1855 |
| |
1854 | 1856 |
| |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
1855 | 1863 |
| |
1856 |
| - | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
1857 | 1867 |
| |
1858 | 1868 |
| |
1859 | 1869 |
| |
| |||
2242 | 2252 |
| |
2243 | 2253 |
| |
2244 | 2254 |
| |
| 2255 | + | |
2245 | 2256 |
| |
2246 | 2257 |
| |
2247 | 2258 |
| |
| |||
2304 | 2315 |
| |
2305 | 2316 |
| |
2306 | 2317 |
| |
2307 |
| - | |
| 2318 | + | |
2308 | 2319 |
| |
2309 | 2320 |
| |
2310 | 2321 |
| |
| |||
2313 | 2324 |
| |
2314 | 2325 |
| |
2315 | 2326 |
| |
2316 |
| - | |
| 2327 | + | |
2317 | 2328 |
| |
2318 | 2329 |
| |
2319 | 2330 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
311 | 311 |
| |
312 | 312 |
| |
313 | 313 |
| |
| 314 | + | |
314 | 315 |
| |
315 | 316 |
| |
316 | 317 |
| |
| |||
1461 | 1462 |
| |
1462 | 1463 |
| |
1463 | 1464 |
| |
| 1465 | + | |
| 1466 | + | |
1464 | 1467 |
| |
1465 | 1468 |
| |
1466 | 1469 |
| |
|
Lines changed: 16 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
| 22 | + | |
22 | 23 |
| |
23 | 24 |
| |
24 | 25 |
| |
| |||
90 | 91 |
| |
91 | 92 |
| |
92 | 93 |
| |
93 |
| - | |
94 |
| - | |
95 |
| - | |
| 94 | + | |
| 95 | + | |
96 | 96 |
| |
97 | 97 |
| |
98 | 98 |
| |
| |||
159 | 159 |
| |
160 | 160 |
| |
161 | 161 |
| |
162 |
| - | |
163 |
| - | |
| 162 | + | |
| 163 | + | |
164 | 164 |
| |
165 | 165 |
| |
166 | 166 |
| |
| |||
171 | 171 |
| |
172 | 172 |
| |
173 | 173 |
| |
174 |
| - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
175 | 179 |
| |
176 | 180 |
| |
177 | 181 |
| |
178 | 182 |
| |
179 | 183 |
| |
180 |
| - | |
181 |
| - | |
| 184 | + | |
| 185 | + | |
182 | 186 |
| |
183 |
| - | |
| 187 | + | |
184 | 188 |
| |
185 | 189 |
| |
186 | 190 |
| |
| |||
204 | 208 |
| |
205 | 209 |
| |
206 | 210 |
| |
207 |
| - | |
208 |
| - | |
209 |
| - | |
210 |
| - | |
211 |
| - | |
212 |
| - | |
| 211 | + | |
| 212 | + | |
213 | 213 |
| |
214 | 214 |
| |
215 |
| - | |
| 215 | + | |
216 | 216 |
| |
217 | 217 |
| |
218 | 218 |
| |
|
Lines changed: 22 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
235 | 235 |
| |
236 | 236 |
| |
237 | 237 |
| |
| 238 | + | |
238 | 239 |
| |
239 | 240 |
| |
240 | 241 |
| |
| |||
3053 | 3054 |
| |
3054 | 3055 |
| |
3055 | 3056 |
| |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
3056 | 3064 |
| |
3057 | 3065 |
| |
3058 | 3066 |
| |
| |||
3061 | 3069 |
| |
3062 | 3070 |
| |
3063 | 3071 |
| |
3064 |
| - | |
3065 |
| - | |
3066 |
| - | |
3067 |
| - | |
3068 |
| - | |
3069 |
| - | |
3070 |
| - | |
3071 |
| - | |
| 3072 | + | |
3072 | 3073 |
| |
| 3074 | + | |
3073 | 3075 |
| |
3074 | 3076 |
| |
3075 | 3077 |
| |
| |||
3402 | 3404 |
| |
3403 | 3405 |
| |
3404 | 3406 |
| |
3405 |
| - | |
| 3407 | + | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
| 3414 | + | |
3406 | 3415 |
| |
3407 | 3416 |
| |
3408 | 3417 |
| |
| |||
3422 | 3431 |
| |
3423 | 3432 |
| |
3424 | 3433 |
| |
3425 |
| - | |
3426 |
| - | |
3427 |
| - | |
3428 |
| - | |
3429 |
| - | |
3430 |
| - | |
3431 | 3434 |
| |
3432 | 3435 |
| |
3433 |
| - | |
3434 | 3436 |
| |
3435 | 3437 |
| |
3436 | 3438 |
| |
| |||
5359 | 5361 |
| |
5360 | 5362 |
| |
5361 | 5363 |
| |
5362 |
| - | |
| 5364 | + | |
| 5365 | + | |
5363 | 5366 |
| |
5364 | 5367 |
| |
5365 | 5368 |
| |
| |||
5670 | 5673 |
| |
5671 | 5674 |
| |
5672 | 5675 |
| |
| 5676 | + | |
| 5677 | + | |
5673 | 5678 |
| |
5674 | 5679 |
| |
5675 | 5680 |
| |
|
Lines changed: 14 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
652 | 652 |
| |
653 | 653 |
| |
654 | 654 |
| |
655 |
| - | |
| 655 | + | |
656 | 656 |
| |
657 | 657 |
| |
658 | 658 |
| |
| |||
723 | 723 |
| |
724 | 724 |
| |
725 | 725 |
| |
726 |
| - | |
727 |
| - | |
728 |
| - | |
729 |
| - | |
730 |
| - | |
731 |
| - | |
732 |
| - | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
733 | 739 |
| |
734 | 740 |
| |
735 | 741 |
| |
|
Lines changed: 27 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1243 | 1243 |
| |
1244 | 1244 |
| |
1245 | 1245 |
| |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
1246 | 1273 |
| |
1247 | 1274 |
| |
1248 | 1275 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
389 | 389 |
| |
390 | 390 |
| |
391 | 391 |
| |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
392 | 407 |
| |
393 | 408 |
| |
394 | 409 |
| |
|
0 commit comments
Comments
(0)