- Notifications
You must be signed in to change notification settings - Fork28
Commit6ef77cf
committed
Further adjust EXPLAIN's choices of table alias names.
This patch causes EXPLAIN to always assign a separate table alias to theparent RTE of an append relation (inheritance set); before, such RTEswere ignored if not actually scanned by the plan. Since the child RTEsnow always have that same alias to start with (cf. commit55a1954),the net effect is that the parent RTE usually gets the alias used orimplied by the query text, and the children all get that alias with "_N"appended. (The exception to "usually" is if there are duplicate aliasesin different subtrees of the original query; then some of those originalRTEs will also have "_N" appended.)This results in more uniform output for partitioned-table plans thanwe had before: the partitioned table itself gets the original alias,and all child tables have aliases with "_N", rather than the previousbehavior where one of the children would get an alias without "_N".The reason for giving the parent RTE an alias, even if it isn't scannedby the plan, is that we now use the parent's alias to qualify Vars thatrefer to an appendrel output column and appear above the Append orMergeAppend that computes the appendrel. But below the append, Varsrefer to some one of the child relations, and are displayed that way.This seems clearer than the old behavior where a Var that could carryvalues from any child relation was displayed as if it referred to onlyone of them.While at it, change ruleutils.c so that the code paths used by EXPLAINdeal in Plan trees not PlanState trees. This effectively reverts adecision made in commit1cc29fe, which seemed like a good idea atthe time to make ruleutils.c consistent with explain.c. However,it's problematic because we'd really like to allow executor startuppruning to remove all the children of an append node when possible,leaving no child PlanState to resolve Vars against. (That's not donehere, but will be in the next patch.) This requires different handlingof subplans and initplans than before, but is otherwise a prettystraightforward change.Discussion:https://postgr.es/m/001001d4f44b$2a2cca50$7e865ef0$@lab.ntt.co.jp1 parentba79cb5 commit6ef77cf
File tree
26 files changed
+1936
-1732
lines changed- contrib/postgres_fdw/expected
- src
- backend
- commands
- executor
- nodes
- optimizer/plan
- utils/adt
- include
- nodes
- utils
- test/regress/expected
26 files changed
+1936
-1732
lines changedLines changed: 45 additions & 45 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7094 | 7094 |
| |
7095 | 7095 |
| |
7096 | 7096 |
| |
7097 |
| - | |
7098 |
| - | |
7099 |
| - | |
| 7097 | + | |
7100 | 7098 |
| |
| 7099 | + | |
| 7100 | + | |
7101 | 7101 |
| |
7102 | 7102 |
| |
7103 | 7103 |
| |
7104 | 7104 |
| |
7105 | 7105 |
| |
7106 | 7106 |
| |
7107 | 7107 |
| |
7108 |
| - | |
7109 |
| - | |
7110 |
| - | |
| 7108 | + | |
7111 | 7109 |
| |
| 7110 | + | |
| 7111 | + | |
7112 | 7112 |
| |
7113 | 7113 |
| |
7114 | 7114 |
| |
| |||
7132 | 7132 |
| |
7133 | 7133 |
| |
7134 | 7134 |
| |
7135 |
| - | |
7136 |
| - | |
7137 |
| - | |
| 7135 | + | |
7138 | 7136 |
| |
| 7137 | + | |
| 7138 | + | |
7139 | 7139 |
| |
7140 | 7140 |
| |
7141 | 7141 |
| |
7142 | 7142 |
| |
7143 | 7143 |
| |
7144 | 7144 |
| |
7145 | 7145 |
| |
7146 |
| - | |
7147 |
| - | |
7148 |
| - | |
| 7146 | + | |
7149 | 7147 |
| |
| 7148 | + | |
| 7149 | + | |
7150 | 7150 |
| |
7151 | 7151 |
| |
7152 | 7152 |
| |
| |||
7180 | 7180 |
| |
7181 | 7181 |
| |
7182 | 7182 |
| |
7183 |
| - | |
7184 |
| - | |
7185 |
| - | |
| 7183 | + | |
7186 | 7184 |
| |
| 7185 | + | |
| 7186 | + | |
7187 | 7187 |
| |
7188 | 7188 |
| |
7189 | 7189 |
| |
| |||
7198 | 7198 |
| |
7199 | 7199 |
| |
7200 | 7200 |
| |
7201 |
| - | |
7202 |
| - | |
7203 |
| - | |
| 7201 | + | |
7204 | 7202 |
| |
| 7203 | + | |
| 7204 | + | |
7205 | 7205 |
| |
7206 | 7206 |
| |
7207 | 7207 |
| |
| |||
7316 | 7316 |
| |
7317 | 7317 |
| |
7318 | 7318 |
| |
7319 |
| - | |
7320 |
| - | |
7321 |
| - | |
| 7319 | + | |
7322 | 7320 |
| |
| 7321 | + | |
| 7322 | + | |
7323 | 7323 |
| |
7324 | 7324 |
| |
7325 | 7325 |
| |
| |||
7356 | 7356 |
| |
7357 | 7357 |
| |
7358 | 7358 |
| |
7359 |
| - | |
7360 |
| - | |
7361 |
| - | |
| 7359 | + | |
7362 | 7360 |
| |
| 7361 | + | |
| 7362 | + | |
7363 | 7363 |
| |
7364 | 7364 |
| |
7365 | 7365 |
| |
| |||
8516 | 8516 |
| |
8517 | 8517 |
| |
8518 | 8518 |
| |
8519 |
| - | |
| 8519 | + | |
8520 | 8520 |
| |
8521 |
| - | |
| 8521 | + | |
8522 | 8522 |
| |
8523 | 8523 |
| |
8524 | 8524 |
| |
| |||
8561 | 8561 |
| |
8562 | 8562 |
| |
8563 | 8563 |
| |
8564 |
| - | |
8565 |
| - | |
| 8564 | + | |
| 8565 | + | |
8566 | 8566 |
| |
8567 | 8567 |
| |
8568 |
| - | |
8569 |
| - | |
| 8568 | + | |
| 8569 | + | |
8570 | 8570 |
| |
8571 | 8571 |
| |
8572 | 8572 |
| |
| |||
8597 | 8597 |
| |
8598 | 8598 |
| |
8599 | 8599 |
| |
8600 |
| - | |
| 8600 | + | |
8601 | 8601 |
| |
8602 |
| - | |
| 8602 | + | |
8603 | 8603 |
| |
8604 | 8604 |
| |
8605 | 8605 |
| |
| |||
8620 | 8620 |
| |
8621 | 8621 |
| |
8622 | 8622 |
| |
8623 |
| - | |
8624 |
| - | |
| 8623 | + | |
| 8624 | + | |
8625 | 8625 |
| |
8626 |
| - | |
| 8626 | + | |
8627 | 8627 |
| |
8628 |
| - | |
8629 |
| - | |
| 8628 | + | |
| 8629 | + | |
8630 | 8630 |
| |
8631 |
| - | |
| 8631 | + | |
8632 | 8632 |
| |
8633 | 8633 |
| |
8634 | 8634 |
| |
| |||
8661 | 8661 |
| |
8662 | 8662 |
| |
8663 | 8663 |
| |
8664 |
| - | |
8665 |
| - | |
| 8664 | + | |
| 8665 | + | |
8666 | 8666 |
| |
8667 | 8667 |
| |
8668 |
| - | |
8669 |
| - | |
| 8668 | + | |
| 8669 | + | |
8670 | 8670 |
| |
8671 | 8671 |
| |
8672 | 8672 |
| |
| |||
8710 | 8710 |
| |
8711 | 8711 |
| |
8712 | 8712 |
| |
8713 |
| - | |
8714 |
| - | |
8715 |
| - | |
| 8713 | + | |
| 8714 | + | |
| 8715 | + | |
8716 | 8716 |
| |
8717 | 8717 |
| |
8718 | 8718 |
| |
|
Lines changed: 41 additions & 24 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
689 | 689 |
| |
690 | 690 |
| |
691 | 691 |
| |
692 |
| - | |
693 |
| - | |
| 692 | + | |
| 693 | + | |
694 | 694 |
| |
695 | 695 |
| |
696 | 696 |
| |
| |||
1034 | 1034 |
| |
1035 | 1035 |
| |
1036 | 1036 |
| |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
1037 | 1045 |
| |
1038 | 1046 |
| |
1039 | 1047 |
| |
| |||
1049 | 1057 |
| |
1050 | 1058 |
| |
1051 | 1059 |
| |
1052 |
| - | |
1053 |
| - | |
| 1060 | + | |
| 1061 | + | |
1054 | 1062 |
| |
1055 | 1063 |
| |
1056 | 1064 |
| |
| |||
1953 | 1961 |
| |
1954 | 1962 |
| |
1955 | 1963 |
| |
1956 |
| - | |
1957 |
| - | |
| 1964 | + | |
| 1965 | + | |
1958 | 1966 |
| |
1959 | 1967 |
| |
1960 | 1968 |
| |
| |||
2075 | 2083 |
| |
2076 | 2084 |
| |
2077 | 2085 |
| |
2078 |
| - | |
2079 |
| - | |
2080 |
| - | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
2081 | 2089 |
| |
2082 | 2090 |
| |
2083 | 2091 |
| |
| |||
2106 | 2114 |
| |
2107 | 2115 |
| |
2108 | 2116 |
| |
2109 |
| - | |
2110 |
| - | |
2111 |
| - | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
2112 | 2120 |
| |
2113 | 2121 |
| |
2114 | 2122 |
| |
| |||
2209 | 2217 |
| |
2210 | 2218 |
| |
2211 | 2219 |
| |
2212 |
| - | |
| 2220 | + | |
2213 | 2221 |
| |
2214 | 2222 |
| |
2215 | 2223 |
| |
| |||
2232 | 2240 |
| |
2233 | 2241 |
| |
2234 | 2242 |
| |
2235 |
| - | |
2236 |
| - | |
2237 |
| - | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
2238 | 2246 |
| |
2239 | 2247 |
| |
2240 | 2248 |
| |
| |||
2339 | 2347 |
| |
2340 | 2348 |
| |
2341 | 2349 |
| |
2342 |
| - | |
| 2350 | + | |
2343 | 2351 |
| |
2344 | 2352 |
| |
2345 | 2353 |
| |
| |||
2371 | 2379 |
| |
2372 | 2380 |
| |
2373 | 2381 |
| |
2374 |
| - | |
2375 |
| - | |
2376 |
| - | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
2377 | 2385 |
| |
2378 | 2386 |
| |
2379 | 2387 |
| |
| |||
2479 | 2487 |
| |
2480 | 2488 |
| |
2481 | 2489 |
| |
2482 |
| - | |
2483 |
| - | |
2484 |
| - | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
2485 | 2493 |
| |
2486 | 2494 |
| |
2487 | 2495 |
| |
| |||
3344 | 3352 |
| |
3345 | 3353 |
| |
3346 | 3354 |
| |
3347 |
| - | |
| 3355 | + | |
3348 | 3356 |
| |
3349 | 3357 |
| |
3350 | 3358 |
| |
| |||
3372 | 3380 |
| |
3373 | 3381 |
| |
3374 | 3382 |
| |
| 3383 | + | |
| 3384 | + | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
3375 | 3390 |
| |
3376 | 3391 |
| |
| 3392 | + | |
| 3393 | + | |
3377 | 3394 |
| |
3378 | 3395 |
| |
3379 | 3396 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
181 | 181 |
| |
182 | 182 |
| |
183 | 183 |
| |
| 184 | + | |
| 185 | + | |
184 | 186 |
| |
185 | 187 |
| |
186 | 188 |
| |
|
Lines changed: 0 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2526 | 2526 |
| |
2527 | 2527 |
| |
2528 | 2528 |
| |
2529 |
| - | |
2530 |
| - | |
2531 |
| - | |
2532 | 2529 |
| |
2533 | 2530 |
| |
2534 | 2531 |
| |
|
0 commit comments
Comments
(0)