Remove some forgotten pieces of default partition for pg10

This commit is contained in:
Julien Rouhaud 2018-11-23 21:53:38 +01:00
parent 3531c0973d
commit c79bebd1c6
2 changed files with 14 additions and 5 deletions

View file

@ -456,9 +456,10 @@ hypo_generate_partitiondesc(hypoTable *parent)
PartitionDesc result;
int ndatums = 0;
int default_index = -1;
#if PG_VERSION_NUM >= 110000
int default_index = -1;
/* Hash partitioning specific */
PartitionHashBound **hbounds = NULL;
#endif
@ -688,8 +689,12 @@ hypo_generate_partitiondesc(hypoTable *parent)
i++;
}
Assert(ndatums == nparts * 2 ||
(default_index != -1 && ndatums == (nparts - 1) * 2));
Assert(ndatums == nparts * 2
#if PG_VERSION_NUM >= 110000
||
(default_index != -1 && ndatums == (nparts - 1) * 2)
#endif
);
/* Sort all the bounds in ascending order */
qsort_arg(all_bounds, ndatums,
@ -770,7 +775,9 @@ hypo_generate_partitiondesc(hypoTable *parent)
boundinfo = (PartitionBoundInfoData *)
palloc0(sizeof(PartitionBoundInfoData));
boundinfo->strategy = key->strategy;
#if PG_VERSION_NUM >= 110000
boundinfo->default_index = -1;
#endif
boundinfo->ndatums = ndatums;
boundinfo->null_index = -1;
boundinfo->datums = (Datum **) palloc0(ndatums * sizeof(Datum *));
@ -861,6 +868,7 @@ hypo_generate_partitiondesc(hypoTable *parent)
boundinfo->null_index = mapping[null_index];
}
#if PG_VERSION_NUM >= 110000
/* Assign mapped index for the default partition. */
if (default_index != -1)
{
@ -875,6 +883,7 @@ hypo_generate_partitiondesc(hypoTable *parent)
mapping[default_index] = next_index++;
boundinfo->default_index = mapping[default_index];
}
#endif
/* All partition must now have a valid mapping */
Assert(next_index == nparts);
@ -931,6 +940,7 @@ hypo_generate_partitiondesc(hypoTable *parent)
}
}
#if PG_VERSION_NUM >= 110000
/* Assign mapped index for the default partition. */
if (default_index != -1)
{
@ -938,6 +948,7 @@ hypo_generate_partitiondesc(hypoTable *parent)
mapping[default_index] = next_index++;
boundinfo->default_index = mapping[default_index];
}
#endif
boundinfo->indexes[i] = -1;
break;
}

View file

@ -58,8 +58,6 @@ typedef struct PartitionBoundInfoData
int *indexes; /* Partition indexes */
int null_index; /* Index of the null-accepting partition; -1
* if there isn't one */
int default_index; /* Index of the default partition; -1 if there
* isn't one */
} PartitionBoundInfoData;
/* One bound of a hash partition */