forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4d04299
committed
Print a given subplan only once in EXPLAIN.
We have, for a very long time, allowed the same subplan (same member of thePlannedStmt.subplans list) to be referenced by more than one SubPlan node;this avoids problems for cases such as subplans within an IndexScan'sindxqual and indxqualorig fields. However, EXPLAIN had not gotten the memoand would print each reference as though it were an independent identicalsubplan. To fix, track plan_ids of subplans we've printed and don't printthe same plan_id twice. Per report from Pavel Stehule.BTW: the particular case of IndexScan didn't cause visible duplicationin a plain EXPLAIN, only EXPLAIN ANALYZE, because in the former case weshort-circuit executor startup before the indxqual field is processed byExecInitExpr. That seems like it could easily lead to other EXPLAINproblems in future, but it's not clear how to avoid it without breakingthe "EXPLAIN a plan using hypothetical indexes" use-case. For now I'veleft that issue alone.Although this is a longstanding bug, it's purely cosmetic (no great harmis done by the repeat printout) and we haven't had field complaints before.So I'm hesitant to back-patch it, especially since there is some small riskof ABI problems due to the need to add a new field to ExplainState.In passing, rearrange order of fields in ExplainState to be less random,and update some obsolete comments about when/where to initialize them.Report: <CAFj8pRAimq+NK-menjt+3J4-LFoodDD8Or6=Lc_stcFD+eD4DA@mail.gmail.com>1 parenta670c24 commit4d04299
2 files changed
+25
-5
lines changedLines changed: 20 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
565 | 565 |
| |
566 | 566 |
| |
567 | 567 |
| |
568 |
| - | |
569 |
| - | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
570 | 571 |
| |
571 | 572 |
| |
572 | 573 |
| |
| |||
576 | 577 |
| |
577 | 578 |
| |
578 | 579 |
| |
| 580 | + | |
579 | 581 |
| |
580 | 582 |
| |
581 | 583 |
| |
582 | 584 |
| |
583 | 585 |
| |
584 | 586 |
| |
585 | 587 |
| |
| 588 | + | |
586 | 589 |
| |
587 | 590 |
| |
588 | 591 |
| |
| |||
2798 | 2801 |
| |
2799 | 2802 |
| |
2800 | 2803 |
| |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
2801 | 2819 |
| |
2802 | 2820 |
| |
2803 | 2821 |
| |
|
Lines changed: 5 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
38 |
| - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 |
| |
40 | 43 |
| |
41 | 44 |
| |
42 |
| - | |
43 |
| - | |
44 | 45 |
| |
| 46 | + | |
45 | 47 |
| |
46 | 48 |
| |
47 | 49 |
| |
|
0 commit comments
Comments
(0)