Skip to content

Commit 805f2bb

Browse files
committed
Use correct symbol for minimum int64 value
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.
1 parent 16e28fc commit 805f2bb

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

contrib/btree_gin/btree_gin.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,7 @@ GIN_SUPPORT(int4)
213213
static Datum
214214
leftmostvalue_int8(void)
215215
{
216-
/*
217-
* Use sequence's definition to keep compatibility.
218-
*/
219-
return Int64GetDatum(SEQ_MINVALUE);
216+
return Int64GetDatum(-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1);
220217
}
221218
static TypeInfo TypeInfo_int8 = {false, leftmostvalue_int8, btint8cmp};
222219

@@ -243,10 +240,7 @@ GIN_SUPPORT(float8)
243240
static Datum
244241
leftmostvalue_money(void)
245242
{
246-
/*
247-
* Use sequence's definition to keep compatibility.
248-
*/
249-
return Int64GetDatum(SEQ_MINVALUE);
243+
return Int64GetDatum(-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1);
250244
}
251245
static TypeInfo TypeInfo_money = {false, leftmostvalue_money, cash_cmp};
252246

0 commit comments

Comments
 (0)