- Notifications
You must be signed in to change notification settings - Fork5
Commit772a6d4
committed
Fix mis-calculation of extParam/allParam sets for plan nodes, as seen in
bug #4290. The fundamental bug is that masking extParam by outer_params,as finalize_plan had been doing, caused us to lose the information thatan initPlan depended on the output of a sibling initPlan. On reflectionthe best thing to do seemed to be not to try to adjust outer_params forthis case but get rid of it entirely. The only thing it was really doingfor us was to filter out param IDs associated with SubPlan nodes, and thatcan be done (with greater accuracy) while processing individual SubPlannodes in finalize_primnode. This approach was vindicated by the discoverythat the masking method was hiding a second bug: SS_finalize_plan failed toremove extParam bits for initPlan output params that were referenced in themain plan tree (it only got rid of those referenced by other initPlans).It's not clear that this caused any real problems, given the limited useof extParam by the executor, but it's certainly not what was intended.I originally thought that there was also a problem with needing to includeindirect dependencies on external params in initPlans' param sets, but itturns out that the executor handles this correctly so long as the depended-oninitPlan is earlier in the initPlans list than the one using its output.That seems a bit of a fragile assumption, but it is true at the moment,so I just documented it in some code comments rather than making what wouldbe rather invasive changes to remove the assumption.Back-patch to 8.1. Previous versions don't have the case of initPlansreferring to other initPlans' outputs, so while the existing logic is stillquestionable for them, there are not any known bugs to be fixed. So I'llrefrain from changing them for now.1 parent6b7eebc commit772a6d4
File tree
5 files changed
+145
-48
lines changed- src
- backend
- executor
- optimizer/plan
- test/regress
- expected
- sql
5 files changed
+145
-48
lines changedLines changed: 14 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
9 |
| - | |
| 9 | + | |
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
| |||
63 | 63 |
| |
64 | 64 |
| |
65 | 65 |
| |
66 |
| - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
67 | 79 |
| |
68 | 80 |
| |
69 | 81 |
| |
|
Lines changed: 6 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
563 | 563 |
| |
564 | 564 |
| |
565 | 565 |
| |
566 |
| - | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
567 | 571 |
| |
568 | 572 |
| |
569 | 573 |
| |
|
Lines changed: 72 additions & 44 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
50 |
| - | |
51 |
| - | |
| 50 | + | |
52 | 51 |
| |
53 | 52 |
| |
54 | 53 |
| |
| |||
68 | 67 |
| |
69 | 68 |
| |
70 | 69 |
| |
71 |
| - | |
72 | 70 |
| |
73 | 71 |
| |
74 | 72 |
| |
| |||
394 | 392 |
| |
395 | 393 |
| |
396 | 394 |
| |
397 |
| - | |
398 | 395 |
| |
399 | 396 |
| |
400 | 397 |
| |
401 |
| - | |
402 |
| - | |
403 |
| - | |
404 |
| - | |
405 |
| - | |
406 |
| - | |
407 |
| - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
408 | 410 |
| |
409 | 411 |
| |
410 | 412 |
| |
| |||
1031 | 1033 |
| |
1032 | 1034 |
| |
1033 | 1035 |
| |
1034 |
| - | |
1035 |
| - | |
| 1036 | + | |
1036 | 1037 |
| |
1037 | 1038 |
| |
1038 | 1039 |
| |
| |||
1042 | 1043 |
| |
1043 | 1044 |
| |
1044 | 1045 |
| |
1045 |
| - | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
1046 | 1050 |
| |
1047 |
| - | |
| 1051 | + | |
1048 | 1052 |
| |
1049 | 1053 |
| |
1050 | 1054 |
| |
| |||
1053 | 1057 |
| |
1054 | 1058 |
| |
1055 | 1059 |
| |
1056 |
| - | |
1057 | 1060 |
| |
1058 | 1061 |
| |
1059 | 1062 |
| |
| |||
1069 | 1072 |
| |
1070 | 1073 |
| |
1071 | 1074 |
| |
1072 |
| - | |
| 1075 | + | |
1073 | 1076 |
| |
1074 |
| - | |
1075 | 1077 |
| |
1076 | 1078 |
| |
1077 | 1079 |
| |
| |||
1107 | 1109 |
| |
1108 | 1110 |
| |
1109 | 1111 |
| |
| 1112 | + | |
| 1113 | + | |
1110 | 1114 |
| |
1111 |
| - | |
1112 |
| - | |
1113 |
| - | |
1114 |
| - | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
1115 | 1119 |
| |
1116 | 1120 |
| |
1117 | 1121 |
| |
| |||
1124 | 1128 |
| |
1125 | 1129 |
| |
1126 | 1130 |
| |
1127 |
| - | |
1128 |
| - | |
| 1131 | + | |
1129 | 1132 |
| |
1130 | 1133 |
| |
1131 | 1134 |
| |
| |||
1134 | 1137 |
| |
1135 | 1138 |
| |
1136 | 1139 |
| |
1137 |
| - | |
1138 | 1140 |
| |
1139 | 1141 |
| |
1140 | 1142 |
| |
| |||
1218 | 1220 |
| |
1219 | 1221 |
| |
1220 | 1222 |
| |
1221 |
| - | |
1222 | 1223 |
| |
1223 | 1224 |
| |
1224 | 1225 |
| |
| |||
1234 | 1235 |
| |
1235 | 1236 |
| |
1236 | 1237 |
| |
1237 |
| - | |
1238 | 1238 |
| |
1239 | 1239 |
| |
1240 | 1240 |
| |
| |||
1250 | 1250 |
| |
1251 | 1251 |
| |
1252 | 1252 |
| |
1253 |
| - | |
1254 | 1253 |
| |
1255 | 1254 |
| |
1256 | 1255 |
| |
| |||
1301 | 1300 |
| |
1302 | 1301 |
| |
1303 | 1302 |
| |
1304 |
| - | |
1305 | 1303 |
| |
1306 | 1304 |
| |
1307 | 1305 |
| |
1308 | 1306 |
| |
1309 | 1307 |
| |
1310 |
| - | |
1311 | 1308 |
| |
1312 | 1309 |
| |
1313 | 1310 |
| |
1314 | 1311 |
| |
1315 | 1312 |
| |
1316 | 1313 |
| |
1317 | 1314 |
| |
1318 |
| - | |
1319 |
| - | |
1320 |
| - | |
1321 | 1315 |
| |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
1322 | 1321 |
| |
1323 | 1322 |
| |
1324 | 1323 |
| |
1325 |
| - | |
| 1324 | + | |
1326 | 1325 |
| |
1327 |
| - | |
1328 | 1326 |
| |
| 1327 | + | |
1329 | 1328 |
| |
1330 |
| - | |
| 1329 | + | |
1331 | 1330 |
| |
1332 |
| - | |
1333 |
| - | |
| 1331 | + | |
| 1332 | + | |
1334 | 1333 |
| |
1335 | 1334 |
| |
1336 | 1335 |
| |
| |||
1359 | 1358 |
| |
1360 | 1359 |
| |
1361 | 1360 |
| |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
1362 | 1380 |
| |
1363 |
| - | |
1364 |
| - | |
1365 |
| - | |
1366 |
| - | |
1367 |
| - | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
1368 | 1396 |
| |
1369 | 1397 |
| |
1370 | 1398 |
| |
|
Lines changed: 27 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
438 | 438 |
| |
439 | 439 |
| |
440 | 440 |
| |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + |
Lines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
272 | 272 |
| |
273 | 273 |
| |
274 | 274 |
| |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + |
0 commit comments
Comments
(0)