@@ -834,22 +834,6 @@ build_range_check_constraint(Oid child_relid,
834
834
return range_constr ;
835
835
}
836
836
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
-
853
837
/* Check if range overlaps with any partitions */
854
838
bool
855
839
check_range_available (Oid parent_relid ,
@@ -882,32 +866,21 @@ check_range_available(Oid parent_relid,
882
866
ranges = PrelGetRangesArray (prel );
883
867
for (i = 0 ; i < PrelChildrenCount (prel ); i ++ )
884
868
{
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);
896
869
int c1 , c2 ;
897
870
898
871
/*
899
872
* 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
902
875
*/
903
876
c1 = (infinite_start || ranges [i ].infinite_max ) ?
904
877
-1 : FunctionCall2 (& cmp_func , start_value , ranges [i ].max );
905
878
/*
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
908
881
*/
909
882
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 );
911
884
912
885
/* There's someone! */
913
886
if (c1 < 0 && c2 > 0 )
0 commit comments