- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitd376ab5
committed
In ExecInitModifyTable, don't scribble on the source plan.
The code carelessly modified mtstate->ps.plan->targetlist,which it's not supposed to do. Fortunately, there's notreally any need to do that because the planner alreadyset up a perfectly acceptable targetlist for the plan node.We just need to remove the erroneous assignments and update somerelevant comments.As it happens, the erroneous assignments caused the targetlist topoint to a different part of the source plan tree, so that thereisn't really a risk of the pointer becoming dangling after executortermination. The only visible effect of this change we can find isthat EXPLAIN will show upper references to the ModifyTable's outputexpressions using different variables. Formerly it showed Vars fromthe first target relation that survived executor-startup pruning.Now it always shows such references using the first relation appearingin the planner output, independently of what happens during executorpruning. On the whole that seems like a good thing.Also make a small tweak in ExplainPreScanNode to ensure that the firstrelation will receive a refname assignment in set_rtable_names, evenif it got pruned at startup. Previously the Vars might be shownwithout any table qualification, which is confusing in a multi-tablequery.I considered back-patching this, but since the bug doesn't seem tohave any really terrible consequences in existing branches, itseems better to not change their EXPLAIN output. It's not too latefor v18 though, especially since v18 already made other changes inthe EXPLAIN output for these cases.Reported-by: Tom Lane <tgl@sss.pgh.pa.us>Author: Andres Freund <andres@anarazel.de>Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/213261.1747611093@sss.pgh.pa.us1 parentf24605e commitd376ab5
File tree
5 files changed
+41
-33
lines changed- src
- backend
- commands
- executor
- optimizer/plan
- test/regress
- expected
- sql
5 files changed
+41
-33
lines changedLines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1220 | 1220 |
| |
1221 | 1221 |
| |
1222 | 1222 |
| |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
1223 | 1227 |
| |
1224 | 1228 |
| |
1225 | 1229 |
| |
|
Lines changed: 4 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4830 | 4830 |
| |
4831 | 4831 |
| |
4832 | 4832 |
| |
4833 |
| - | |
4834 |
| - | |
| 4833 | + | |
| 4834 | + | |
| 4835 | + | |
| 4836 | + | |
4835 | 4837 |
| |
4836 |
| - | |
4837 |
| - | |
4838 |
| - | |
4839 | 4838 |
| |
4840 | 4839 |
| |
4841 | 4840 |
| |
| |||
4865 | 4864 |
| |
4866 | 4865 |
| |
4867 | 4866 |
| |
4868 |
| - | |
4869 | 4867 |
| |
4870 | 4868 |
| |
4871 | 4869 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1097 | 1097 |
| |
1098 | 1098 |
| |
1099 | 1099 |
| |
1100 |
| - | |
1101 |
| - | |
1102 |
| - | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
1103 | 1104 |
| |
1104 | 1105 |
| |
1105 | 1106 |
| |
|
Lines changed: 26 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4553 | 4553 |
| |
4554 | 4554 |
| |
4555 | 4555 |
| |
4556 |
| - | |
4557 |
| - | |
4558 |
| - | |
4559 |
| - | |
4560 |
| - | |
| 4556 | + | |
| 4557 | + | |
| 4558 | + | |
| 4559 | + | |
| 4560 | + | |
| 4561 | + | |
4561 | 4562 |
| |
4562 | 4563 |
| |
4563 |
| - | |
4564 |
| - | |
4565 |
| - | |
| 4564 | + | |
| 4565 | + | |
| 4566 | + | |
| 4567 | + | |
4566 | 4568 |
| |
4567 | 4569 |
| |
4568 | 4570 |
| |
4569 | 4571 |
| |
4570 | 4572 |
| |
4571 | 4573 |
| |
4572 | 4574 |
| |
4573 |
| - | |
4574 |
| - | |
4575 |
| - | |
4576 |
| - | |
4577 |
| - | |
| 4575 | + | |
| 4576 | + | |
| 4577 | + | |
| 4578 | + | |
| 4579 | + | |
| 4580 | + | |
4578 | 4581 |
| |
4579 | 4582 |
| |
4580 |
| - | |
4581 |
| - | |
4582 |
| - | |
| 4583 | + | |
| 4584 | + | |
| 4585 | + | |
| 4586 | + | |
4583 | 4587 |
| |
4584 | 4588 |
| |
4585 | 4589 |
| |
4586 | 4590 |
| |
4587 | 4591 |
| |
4588 |
| - | |
4589 |
| - | |
4590 |
| - | |
4591 |
| - | |
| 4592 | + | |
| 4593 | + | |
| 4594 | + | |
| 4595 | + | |
| 4596 | + | |
4592 | 4597 |
| |
4593 | 4598 |
| |
4594 |
| - | |
| 4599 | + | |
4595 | 4600 |
| |
4596 | 4601 |
| |
4597 | 4602 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1371 | 1371 |
| |
1372 | 1372 |
| |
1373 | 1373 |
| |
1374 |
| - | |
| 1374 | + | |
1375 | 1375 |
| |
1376 |
| - | |
| 1376 | + | |
1377 | 1377 |
| |
1378 | 1378 |
| |
1379 |
| - | |
| 1379 | + | |
1380 | 1380 |
| |
1381 | 1381 |
| |
1382 | 1382 |
| |
|
0 commit comments
Comments
(0)