- Notifications
You must be signed in to change notification settings - Fork5.1k
Commit928df06
committed
Fix incorrect targetlist in dummy UNIONs
The prior code, added in03d40e4 attempted to use the targetlist of thefirst UNION child when all UNION children were proven as dummy rels.That's not going to work when some operation atop of the Result node mustfind target entries within the Result's targetlist. This could have beensomething as simple as trying to sort the results of the UNION operation,which would lead to:ERROR: could not find pathkey item to sortInstead, use the top-level UNION's targetlist and fix the varnos insetrefs.c. Because set operation targetlists always use varno==0, wecan rewrite those to become varno==1, i.e. use the Vars from the firstUNION child. This does result in showing Vars from relations that arenot present in the final plan, but that's no different to what we seewhen normal base relations are proven dummy.Without this fix it would be possible to see the following error inEXPLAIN VERBOSE when all UNION inputs were proven empty.ERROR: bogus varno: 0Author: David Rowley <dgrowleyml@gmail.com>Discussion:https://postgr.es/m/CAApHDvrUASy9sfULMEsM2udvZJP6AoBRCZvHYXYxZTy2tX9FYw@mail.gmail.com1 parent771cfe2 commit928df06
File tree
4 files changed
+36
-13
lines changed- src
- backend/optimizer
- plan
- prep
- test/regress
- expected
- sql
4 files changed
+36
-13
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1034 | 1034 |
| |
1035 | 1035 |
| |
1036 | 1036 |
| |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
1037 | 1046 |
| |
1038 | 1047 |
| |
1039 | 1048 |
| |
1040 | 1049 |
| |
1041 | 1050 |
| |
1042 | 1051 |
| |
1043 |
| - | |
1044 |
| - | |
1045 |
| - | |
1046 |
| - | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
1047 | 1066 |
| |
1048 | 1067 |
| |
1049 | 1068 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
826 | 826 |
| |
827 | 827 |
| |
828 | 828 |
| |
829 |
| - | |
830 | 829 |
| |
831 | 830 |
| |
832 | 831 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1258 | 1258 |
| |
1259 | 1259 |
| |
1260 | 1260 |
| |
1261 |
| - | |
1262 |
| - | |
1263 |
| - | |
1264 |
| - | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
1265 | 1266 |
| |
1266 |
| - | |
1267 |
| - | |
1268 |
| - | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
1269 | 1273 |
| |
1270 | 1274 |
| |
1271 | 1275 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
484 | 484 |
| |
485 | 485 |
| |
486 | 486 |
| |
487 |
| - | |
| 487 | + | |
| 488 | + | |
488 | 489 |
| |
489 | 490 |
| |
490 | 491 |
| |
|
0 commit comments
Comments
(0)