aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-12-01 13:52:59 -0500
committerRobert Haas <rhaas@postgresql.org>2017-12-01 13:52:59 -0500
commit35438e5763c3021e579472e4b0c4a4d6038570b4 (patch)
tree911548dedc99cf9058114a7222d56a79503327d7 /src/backend
parent950222780535e6d2ea560cd8b3db5308652ddd42 (diff)
downloadpostgresql-35438e5763c3021e579472e4b0c4a4d6038570b4.tar.gz
postgresql-35438e5763c3021e579472e4b0c4a4d6038570b4.zip
Minor code beautification in partition_bounds_equal.
Use get_greatest_modulus more consistently, instead of doing the same thing in an ad-hoc manner in this one place. Ashutosh Bapat Discussion: http://postgr.es/m/CAFjFpReT9L4RCiJBKOyWC2=i02kv9uG2fx=4Fv7kFY2t0SPCgw@mail.gmail.com
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/catalog/partition.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c
index 2bf81177579..dd4a8d3c02d 100644
--- a/src/backend/catalog/partition.c
+++ b/src/backend/catalog/partition.c
@@ -751,15 +751,13 @@ partition_bounds_equal(int partnatts, int16 *parttyplen, bool *parttypbyval,
if (b1->strategy == PARTITION_STRATEGY_HASH)
{
- int greatest_modulus;
+ int greatest_modulus = get_greatest_modulus(b1);
/*
* If two hash partitioned tables have different greatest moduli,
- * their partition schemes don't match. For hash partitioned table,
- * the greatest modulus is given by the last datum and number of
- * partitions is given by ndatums.
+ * their partition schemes don't match.
*/
- if (b1->datums[b1->ndatums - 1][0] != b2->datums[b2->ndatums - 1][0])
+ if (greatest_modulus != get_greatest_modulus(b2))
return false;
/*
@@ -773,7 +771,6 @@ partition_bounds_equal(int partnatts, int16 *parttyplen, bool *parttypbyval,
* their indexes array will be same. So, it suffices to compare
* indexes array.
*/
- greatest_modulus = get_greatest_modulus(b1);
for (i = 0; i < greatest_modulus; i++)
if (b1->indexes[i] != b2->indexes[i])
return false;