Permalink
Browse files

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.
  • Loading branch information...
rjuju committed Nov 23, 2018
1 parent db266cb commit 3531c0973d5b20ffb4bed51de9ff4f3985811536
Showing with 6 additions and 5 deletions.
  1. +6 −1 Makefile
  2. +0 −4 hypopg_table.c
@@ -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)

@@ -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 **)

0 comments on commit 3531c09

Please sign in to comment.