Skip to content

Commit fd46919

Browse files
committed
fix config loading
1 parent a682742 commit fd46919

File tree

2 files changed

+7
-32
lines changed

2 files changed

+7
-32
lines changed

src/init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,9 +870,11 @@ cmp_range_entries(const void *p1, const void *p2, void *arg)
870870

871871
/* If range is half open */
872872
if (v1->infinite_min)
873+
{
873874
if (v2->infinite_min)
874875
return Int32GetDatum(0);
875876
return Int32GetDatum(-1);
877+
}
876878

877879
/* Else if range is closed */
878880
return OidFunctionCall2(cmp_proc_oid, v1->min, v2->min);

src/partition_creation.c

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -834,22 +834,6 @@ build_range_check_constraint(Oid child_relid,
834834
return range_constr;
835835
}
836836

837-
// static int16_t
838-
// cmp_boundaries(FmgrInfo cmp_func, Datum s1, Datum s2, bool s1_infinite, bool s2_infinite)
839-
// {
840-
// if (s1_infinite && s2_infinite)
841-
// elog(ERROR,
842-
// "two half open ranges are overlap");
843-
844-
// if (s1_infinite)
845-
// return -1;
846-
847-
// if (s2_infinite)
848-
// return 1;
849-
850-
// return DatumGetInt16(FunctionCall2(&cmp_func, start_value, ranges[i].max));
851-
// }
852-
853837
/* Check if range overlaps with any partitions */
854838
bool
855839
check_range_available(Oid parent_relid,
@@ -882,32 +866,21 @@ check_range_available(Oid parent_relid,
882866
ranges = PrelGetRangesArray(prel);
883867
for (i = 0; i < PrelChildrenCount(prel); i++)
884868
{
885-
// int c1 = cmp_boundaries(cmp_func, start_value, ranges[i].max, infinite_start, ranges[i].infinite_max);
886-
// int c2 = cmp_boundaries(cmp_func, end_value, ranges[i].min, infinite_end, ranges[i].infinite_min);
887-
888-
/* If both ranges are half open then they are obviously overlap */
889-
// if (infinite_start && ranges[i].infinite_max)
890-
// return false;
891-
// if (infinite_end && ranges[i].infinite_min)
892-
// return false;
893-
894-
// int c1 = FunctionCall2(&cmp_func, start_value, ranges[i].max),
895-
// c2 = FunctionCall2(&cmp_func, end_value, ranges[i].min);
896869
int c1, c2;
897870

898871
/*
899872
* If the range we're checking starts with minus infinity or current
900-
* range is ends in plus infinity then the left boundary of the first
901-
* one is on the left
873+
* range ends in plus infinity then the left boundary of the first
874+
* range is on the left. Otherwise compare specific values
902875
*/
903876
c1 = (infinite_start || ranges[i].infinite_max) ?
904877
-1 : FunctionCall2(&cmp_func, start_value, ranges[i].max);
905878
/*
906-
* Similary check the right boundary of first range is on the right
907-
* of the beginning of second one
879+
* Similary check that right boundary of the range we're checking is on
880+
* the right of the beginning of the current one
908881
*/
909882
c2 = (infinite_end || ranges[i].infinite_min) ?
910-
-1 : FunctionCall2(&cmp_func, end_value, ranges[i].max);
883+
-1 : FunctionCall2(&cmp_func, end_value, ranges[i].min);
911884

912885
/* There's someone! */
913886
if (c1 < 0 && c2 > 0)

0 commit comments

Comments
 (0)