Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 26cb820

Browse files
committed
Improve some comments related to executor result relations.
es_leaf_result_relations doesn't exist; perhaps this was an old name for es_tuple_routing_result_relations, or maybe this comment has gone unmaintained through multiple rounds of whacking the code around. Related comment in execnodes.h was both obsolete and ungrammatical.
1 parent 48d818e commit 26cb820

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/backend/executor/execMain.c

+11-8
Original file line numberDiff line numberDiff line change
@@ -1347,14 +1347,16 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo,
13471347
}
13481348

13491349
/*
1350-
* ExecGetTriggerResultRel
1351-
*
1352-
* Get a ResultRelInfo for a trigger target relation. Most of the time,
1353-
* triggers are fired on one of the result relations of the query, and so
1354-
* we can just return a member of the es_result_relations array, the
1355-
* es_root_result_relations array (if any), or the es_leaf_result_relations
1356-
* list (if any). (Note: in self-join situations there might be multiple
1357-
* members with the same OID; if so it doesn't matter which one we pick.)
1350+
* ExecGetTriggerResultRel
1351+
* Get a ResultRelInfo for a trigger target relation.
1352+
*
1353+
* Most of the time, triggers are fired on one of the result relations of the
1354+
* query, and so we can just return a member of the es_result_relations array,
1355+
* or the es_root_result_relations array (if any), or the
1356+
* es_tuple_routing_result_relations list (if any). (Note: in self-join
1357+
* situations there might be multiple members with the same OID; if so it
1358+
* doesn't matter which one we pick.)
1359+
*
13581360
* However, it is sometimes necessary to fire triggers on other relations;
13591361
* this happens mainly when an RI update trigger queues additional triggers
13601362
* on other relations, which will be processed in the context of the outer
@@ -1404,6 +1406,7 @@ ExecGetTriggerResultRel(EState *estate, Oid relid)
14041406
if (RelationGetRelid(rInfo->ri_RelationDesc) == relid)
14051407
return rInfo;
14061408
}
1409+
14071410
/* Nope, but maybe we already made an extra ResultRelInfo for it */
14081411
foreach(l, estate->es_trig_target_relations)
14091412
{

src/include/nodes/execnodes.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,10 @@ typedef struct EState
508508
ResultRelInfo *es_result_relation_info; /* currently active array elt */
509509

510510
/*
511-
* Info about the target partitioned target table root(s) for
512-
* update/delete queries. They required only to fire any per-statement
513-
* triggers defined on the table. It exists separately from
514-
* es_result_relations, because partitioned tables don't appear in the
515-
* plan tree for the update/delete cases.
511+
* Info about the partition root table(s) for insert/update/delete queries
512+
* targeting partitioned tables. Only leaf partitions are mentioned in
513+
* es_result_relations, but we need access to the roots for firing
514+
* triggers and for runtime tuple routing.
516515
*/
517516
ResultRelInfo *es_root_result_relations; /* array of ResultRelInfos */
518517
int es_num_root_result_relations; /* length of the array */

0 commit comments

Comments
 (0)