aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/partitioning/partbounds.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/backend/partitioning/partbounds.c b/src/backend/partitioning/partbounds.c
index 2d61c3f6e36..54eb83a0d1a 100644
--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -789,6 +789,8 @@ partition_bounds_copy(PartitionBoundInfo src,
int ndatums;
int partnatts;
int num_indexes;
+ bool hash_part;
+ int natts;
dest = (PartitionBoundInfo) palloc(sizeof(PartitionBoundInfoData));
@@ -819,17 +821,17 @@ partition_bounds_copy(PartitionBoundInfo src,
else
dest->kind = NULL;
+ /*
+ * For hash partitioning, datums array will have two elements - modulus and
+ * remainder.
+ */
+ hash_part = (key->strategy == PARTITION_STRATEGY_HASH);
+ natts = hash_part ? 2 : partnatts;
+
for (i = 0; i < ndatums; i++)
{
int j;
- /*
- * For a corresponding hash partition, datums array will have two
- * elements - modulus and remainder.
- */
- bool hash_part = (key->strategy == PARTITION_STRATEGY_HASH);
- int natts = hash_part ? 2 : partnatts;
-
dest->datums[i] = (Datum *) palloc(sizeof(Datum) * natts);
for (j = 0; j < natts; j++)