Use correct symbol for minimum int64 value
authorPeter Eisentraut <[email protected]>
Sun, 17 Jul 2016 13:37:33 +0000 (09:37 -0400)
committerPeter Eisentraut <[email protected]>
Sun, 17 Jul 2016 13:41:08 +0000 (09:41 -0400)
The old code used SEQ_MINVALUE to get the smallest int64 value.  This
was done as a convenience to avoid having to deal with INT64_IS_BUSTED,
but that is obsolete now.  Also, it is incorrect because the smallest
int64 value is actually SEQ_MINVALUE-1.  Fix by writing out the constant
the long way, as it is done elsewhere in the code.

contrib/btree_gin/btree_gin.c

index 5c4f58b8b1f2142e730540cd125ea523da5205c8..56ee26519f6a1b2aded667c131eb6fd93ddbca85 100644 (file)
@@ -214,10 +214,7 @@ GIN_SUPPORT(int4)
 static Datum
 leftmostvalue_int8(void)
 {
-   /*
-    * Use sequence's definition to keep compatibility.
-    */
-   return Int64GetDatum(SEQ_MINVALUE);
+   return Int64GetDatum(-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1);
 }
 static TypeInfo TypeInfo_int8 = {false, leftmostvalue_int8, btint8cmp};
 
@@ -244,10 +241,7 @@ GIN_SUPPORT(float8)
 static Datum
 leftmostvalue_money(void)
 {
-   /*
-    * Use sequence's definition to keep compatibility.
-    */
-   return Int64GetDatum(SEQ_MINVALUE);
+   return Int64GetDatum(-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1);
 }
 static TypeInfo TypeInfo_money = {false, leftmostvalue_money, cash_cmp};