forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7cfdc77

Etsuro Fujita
Disable support for partitionwise joins in problematic cases.
Commitf49842d, which added support for partitionwise joins, built thechild's tlist by applying adjust_appendrel_attrs() to the parent's. So inthe case where the parent's included a whole-row Var for the parent, thechild's contained a ConvertRowtypeExpr. To cope with that, that commitadded code to the planner, such as setrefs.c, but some code paths stillassumed that the tlist for a scan (or join) rel would only include Varsand PlaceHolderVars, which was true before that commit, causing errors:* When creating an explicit sort node for an input path for a mergejoin path for a child join, prepare_sort_from_pathkeys() threw the 'could not find pathkey item to sort' error.* When deparsing a relation participating in a pushed down child join as a subquery in contrib/postgres_fdw, get_relation_column_alias_ids() threw the 'unexpected expression in subquery output' error.* When performing set_plan_references() on a local join plan generated by contrib/postgres_fdw for EvalPlanQual support for a pushed down child join, fix_join_expr() threw the 'variable not found in subplan target lists' error.To fix these, two approaches have been proposed: one by Ashutosh Bapat andone by me. While the former keeps building the child's tlist with aConvertRowtypeExpr, the latter builds it with a whole-row Var for thechild not to violate the planner assumption, and tries to fix it up later,But both approaches need more work, so refuse to generate partitionwisejoin paths when whole-row Vars are involved, instead. We don't need tohandle ConvertRowtypeExprs in the child's tlists for now, so this commitalso removes the changes to the planner.Previously, partitionwise join computed attr_needed data for each childseparately, and built the child join's tlist using that data, which alsorequired an extra step for adding PlaceHolderVars to that tlist, but itwould be more efficient to build it from the parent join's tlist throughthe adjust_appendrel_attrs() transformation. So this commit builds thatlist that way, and simplifies build_joinrel_tlist() and placeholder.c aswell as part of set_append_rel_size() to basically what they were beforepartitionwise join went in.Back-patch to PG11 where partitionwise join was introduced.Report by Rajkumar Raghuwanshi. Analysis by Ashutosh Bapat, who alsoprovided some of regression tests. Patch by me, reviewed by Robert Haas.Discussion:https://postgr.es/m/CAKcux6ktu-8tefLWtQuuZBYFaZA83vUzuRd7c1YHC-yEWyYFpg@mail.gmail.com1 parentbb60f2c commit7cfdc77
File tree
13 files changed
+266
-256
lines changed- contrib/postgres_fdw
- expected
- sql
- src
- backend
- nodes
- optimizer
- path
- plan
- util
- include/nodes
- test/regress
- expected
- sql
13 files changed
+266
-256
lines changedLines changed: 57 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8337 | 8337 |
| |
8338 | 8338 |
| |
8339 | 8339 |
| |
8340 |
| - | |
| 8340 | + | |
8341 | 8341 |
| |
| 8342 | + | |
8342 | 8343 |
| |
8343 | 8344 |
| |
8344 | 8345 |
| |
| |||
8389 | 8390 |
| |
8390 | 8391 |
| |
8391 | 8392 |
| |
8392 |
| - | |
| 8393 | + | |
8393 | 8394 |
| |
8394 |
| - | |
8395 |
| - | |
8396 |
| - | |
| 8395 | + | |
| 8396 | + | |
| 8397 | + | |
8397 | 8398 |
| |
8398 | 8399 |
| |
8399 |
| - | |
8400 |
| - | |
8401 |
| - | |
8402 |
| - | |
8403 |
| - | |
8404 |
| - | |
| 8400 | + | |
| 8401 | + | |
| 8402 | + | |
| 8403 | + | |
| 8404 | + | |
| 8405 | + | |
| 8406 | + | |
| 8407 | + | |
| 8408 | + | |
| 8409 | + | |
8405 | 8410 |
| |
8406 |
| - | |
8407 |
| - | |
| 8411 | + | |
| 8412 | + | |
8408 | 8413 |
| |
8409 | 8414 |
| |
| 8415 | + | |
| 8416 | + | |
8410 | 8417 |
| |
| 8418 | + | |
8411 | 8419 |
| |
| 8420 | + | |
| 8421 | + | |
8412 | 8422 |
| |
8413 |
| - | |
| 8423 | + | |
| 8424 | + | |
| 8425 | + | |
| 8426 | + | |
| 8427 | + | |
| 8428 | + | |
8414 | 8429 |
| |
8415 | 8430 |
| |
8416 | 8431 |
| |
| |||
8474 | 8489 |
| |
8475 | 8490 |
| |
8476 | 8491 |
| |
| 8492 | + | |
| 8493 | + | |
| 8494 | + | |
| 8495 | + | |
| 8496 | + | |
| 8497 | + | |
| 8498 | + | |
| 8499 | + | |
| 8500 | + | |
| 8501 | + | |
| 8502 | + | |
| 8503 | + | |
| 8504 | + | |
| 8505 | + | |
| 8506 | + | |
| 8507 | + | |
| 8508 | + | |
| 8509 | + | |
| 8510 | + | |
| 8511 | + | |
| 8512 | + | |
| 8513 | + | |
| 8514 | + | |
| 8515 | + | |
| 8516 | + | |
| 8517 | + | |
| 8518 | + | |
| 8519 | + | |
8477 | 8520 |
| |
8478 | 8521 |
| |
8479 | 8522 |
| |
|
Lines changed: 10 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2263 | 2263 |
| |
2264 | 2264 |
| |
2265 | 2265 |
| |
2266 |
| - | |
| 2266 | + | |
2267 | 2267 |
| |
| 2268 | + | |
2268 | 2269 |
| |
2269 | 2270 |
| |
2270 | 2271 |
| |
| |||
2281 | 2282 |
| |
2282 | 2283 |
| |
2283 | 2284 |
| |
2284 |
| - | |
| 2285 | + | |
2285 | 2286 |
| |
2286 |
| - | |
2287 |
| - | |
| 2287 | + | |
| 2288 | + | |
2288 | 2289 |
| |
2289 | 2290 |
| |
2290 | 2291 |
| |
| |||
2296 | 2297 |
| |
2297 | 2298 |
| |
2298 | 2299 |
| |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
2299 | 2305 |
| |
2300 | 2306 |
| |
2301 | 2307 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2368 | 2368 |
| |
2369 | 2369 |
| |
2370 | 2370 |
| |
| 2371 | + | |
2371 | 2372 |
| |
2372 | 2373 |
| |
2373 | 2374 |
| |
|
Lines changed: 30 additions & 48 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
909 | 909 |
| |
910 | 910 |
| |
911 | 911 |
| |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
912 | 923 |
| |
913 | 924 |
| |
914 | 925 |
| |
| |||
956 | 967 |
| |
957 | 968 |
| |
958 | 969 |
| |
959 |
| - | |
960 |
| - | |
961 |
| - | |
962 |
| - | |
963 |
| - | |
964 |
| - | |
965 |
| - | |
966 |
| - | |
967 |
| - | |
968 |
| - | |
969 |
| - | |
970 |
| - | |
971 |
| - | |
972 |
| - | |
973 |
| - | |
974 |
| - | |
975 |
| - | |
976 |
| - | |
977 |
| - | |
978 |
| - | |
979 |
| - | |
980 |
| - | |
981 |
| - | |
982 |
| - | |
983 |
| - | |
984 |
| - | |
985 |
| - | |
986 |
| - | |
987 |
| - | |
988 |
| - | |
989 |
| - | |
990 |
| - | |
991 |
| - | |
992 |
| - | |
993 |
| - | |
994 |
| - | |
995 |
| - | |
996 |
| - | |
997 |
| - | |
998 |
| - | |
999 |
| - | |
1000 |
| - | |
1001 |
| - | |
1002 |
| - | |
1003 |
| - | |
1004 |
| - | |
1005 |
| - | |
1006 |
| - | |
1007 | 970 |
| |
1008 | 971 |
| |
1009 | 972 |
| |
| |||
1180 | 1143 |
| |
1181 | 1144 |
| |
1182 | 1145 |
| |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
1183 | 1162 |
| |
1184 | 1163 |
| |
1185 | 1164 |
| |
| |||
3538 | 3517 |
| |
3539 | 3518 |
| |
3540 | 3519 |
| |
| 3520 | + | |
| 3521 | + | |
| 3522 | + | |
3541 | 3523 |
| |
3542 | 3524 |
| |
3543 | 3525 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1322 | 1322 |
| |
1323 | 1323 |
| |
1324 | 1324 |
| |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
1325 | 1328 |
| |
1326 | 1329 |
| |
1327 | 1330 |
| |
| |||
1330 | 1333 |
| |
1331 | 1334 |
| |
1332 | 1335 |
| |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
1333 | 1340 |
| |
1334 | 1341 |
| |
1335 | 1342 |
| |
|
0 commit comments
Comments
(0)