summaryrefslogtreecommitdiff
path: root/contrib/pg_overexplain
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/pg_overexplain')
-rw-r--r--contrib/pg_overexplain/expected/pg_overexplain.out6
-rw-r--r--contrib/pg_overexplain/pg_overexplain.c12
2 files changed, 16 insertions, 2 deletions
diff --git a/contrib/pg_overexplain/expected/pg_overexplain.out b/contrib/pg_overexplain/expected/pg_overexplain.out
index 6de02323d7c..55d34666d87 100644
--- a/contrib/pg_overexplain/expected/pg_overexplain.out
+++ b/contrib/pg_overexplain/expected/pg_overexplain.out
@@ -44,9 +44,10 @@ EXPLAIN (RANGE_TABLE) SELECT 1;
QUERY PLAN
------------------------------------------
Result (cost=0.00..0.01 rows=1 width=4)
+ RTIs: 1
RTI 1 (result):
Eref: "*RESULT*" ()
-(3 rows)
+(4 rows)
-- Create a partitioned table.
CREATE TABLE vegetables (id serial, name text, genus text)
@@ -475,6 +476,7 @@ INSERT INTO vegetables (name, genus) VALUES ('broccoflower', 'brassica');
Nominal RTI: 1
Exclude Relation RTI: 0
-> Result
+ RTIs: 2
RTI 1 (relation):
Eref: vegetables (id, name, genus)
Relation: vegetables
@@ -485,5 +487,5 @@ INSERT INTO vegetables (name, genus) VALUES ('broccoflower', 'brassica');
Eref: "*RESULT*" ()
Unprunable RTIs: 1
Result RTIs: 1
-(14 rows)
+(15 rows)
diff --git a/contrib/pg_overexplain/pg_overexplain.c b/contrib/pg_overexplain/pg_overexplain.c
index de824566f8c..bd70b6d9d5e 100644
--- a/contrib/pg_overexplain/pg_overexplain.c
+++ b/contrib/pg_overexplain/pg_overexplain.c
@@ -236,6 +236,18 @@ overexplain_per_node_hook(PlanState *planstate, List *ancestors,
((MergeAppend *) plan)->apprelids,
es);
break;
+ case T_Result:
+
+ /*
+ * 'relids' is only meaningful when plan->lefttree is NULL,
+ * but if somehow it ends up set when plan->lefttree is not
+ * NULL, print it anyway.
+ */
+ if (plan->lefttree == NULL ||
+ ((Result *) plan)->relids != NULL)
+ overexplain_bitmapset("RTIs",
+ ((Result *) plan)->relids,
+ es);
default:
break;
}