aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2018-05-18 16:09:14 -0400
committerRobert Haas <rhaas@postgresql.org>2018-05-18 16:11:22 -0400
commitb949bbcb7eaf3719b541cbae99ef6c4b031174a1 (patch)
treedf731dd6db422b7136d94353099e7a195ed7ef42 /src
parentdbccdd375b41618ca4ee3d1ea7109ab7f95d0865 (diff)
downloadpostgresql-b949bbcb7eaf3719b541cbae99ef6c4b031174a1.tar.gz
postgresql-b949bbcb7eaf3719b541cbae99ef6c4b031174a1.zip
Further adjust comment in get_partition_dispatch_recurse.
In editing 09b12d52db1cf1a4c72d876f3fb6c9d06919e51a I made it wrong; fix that and try to more clearly explain the situation. Patch by me, reviewed by David Rowley and Amit Langote Discussion: http://postgr.es/m/CA+TgmobAq+mA5hzm0a5OS38qQY5758DDDGqa3sBJN4hvir-H9w@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/executor/execPartition.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c
index 75329b36241..c83991c93c5 100644
--- a/src/backend/executor/execPartition.c
+++ b/src/backend/executor/execPartition.c
@@ -973,11 +973,13 @@ get_partition_dispatch_recurse(Relation rel, Relation parent,
* The 'indexes' array is used when searching for a partition matching a
* given tuple. The actual value we store here depends on whether the
* array element belongs to a leaf partition or a subpartitioned table.
- * For leaf partitions we store the 0-based index into *leaf_part_oids,
- * and for sub-partitioned tables we store a negative version of the
- * 1-based index into the *pds list. When searching, if we see a negative
- * value, the search must continue in the corresponding sub-partition;
- * otherwise, we've identified the correct partition.
+ * For leaf partitions we store the index into *leaf_part_oids, and for
+ * sub-partitioned tables we store a negative version of the index into
+ * the *pds list. Both indexes are 0-based, but the first element of the
+ * *pds list is the root partition, so 0 always means the first leaf. When
+ * searching, if we see a negative value, the search must continue in the
+ * corresponding sub-partition; otherwise, we've identified the correct
+ * partition.
*/
pd->indexes = (int *) palloc(partdesc->nparts * sizeof(int));
for (i = 0; i < partdesc->nparts; i++)