Reintroduce childrel expanding order for pg10

The partitions has to be sorted by bound order, otherwise many things
can break.

This commit also introduce specific regression tests for pg10, for which
the duplucate sanity check would not exhibit the expected error without
the expanded order.

Some of these new regression tests still fails, due to minor change in
the join or partition order, we'll see if we can fix the behavior or change
the expected results.
This commit is contained in:
Julien Rouhaud 2018-11-23 21:40:19 +01:00
parent db266cb458
commit 3531c0973d
2 changed files with 6 additions and 5 deletions

View file

@ -35,10 +35,15 @@ include $(PGXS)
ifeq ($(MAJORVERSION),$(filter $(MAJORVERSION),9.2 9.3 9.4 9.5 9.6))
REGRESS += hypo_no_table
else
ifeq ($(MAJORVERSION),$(filter $(MAJORVERSION),10))
REGRESS += hypo_table_10 \
hypo_index_table_10
else
REGRESS += hypo_table \
hypo_index_table
endif
endif # pg10
endif # pg 11+
DEBUILD_ROOT = /tmp/$(EXTENSION)

View file

@ -632,10 +632,8 @@ hypo_generate_partitiondesc(hypoTable *parent)
i++;
}
#if PG_VERSION_NUM >= 110000
qsort_arg(all_values, ndatums, sizeof(PartitionListValue *),
qsort_partition_list_value_cmp, (void *) key);
#endif
}
else if (key->strategy == PARTITION_STRATEGY_RANGE)
{
@ -693,13 +691,11 @@ hypo_generate_partitiondesc(hypoTable *parent)
Assert(ndatums == nparts * 2 ||
(default_index != -1 && ndatums == (nparts - 1) * 2));
#if PG_VERSION_NUM >= 110000
/* Sort all the bounds in ascending order */
qsort_arg(all_bounds, ndatums,
sizeof(PartitionRangeBound *),
qsort_partition_rbound_cmp,
(void *) key);
#endif
/* Save distinct bounds from all_bounds into rbounds. */
rbounds = (PartitionRangeBound **)