Commit f512a6e1 authored by Andres Freund's avatar Andres Freund

Consistently use PG_INT(16|32|64)_(MIN|MAX).

Per buildfarm animal woodlouse.
parent 4c6744ed
...@@ -101,7 +101,7 @@ cash_dist(PG_FUNCTION_ARGS) ...@@ -101,7 +101,7 @@ cash_dist(PG_FUNCTION_ARGS)
Cash ra; Cash ra;
if (pg_sub_s64_overflow(a, b, &r) || if (pg_sub_s64_overflow(a, b, &r) ||
r == INT64_MIN) r == PG_INT64_MIN)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("money out of range"))); errmsg("money out of range")));
......
...@@ -100,7 +100,7 @@ int2_dist(PG_FUNCTION_ARGS) ...@@ -100,7 +100,7 @@ int2_dist(PG_FUNCTION_ARGS)
int16 ra; int16 ra;
if (pg_sub_s16_overflow(a, b, &r) || if (pg_sub_s16_overflow(a, b, &r) ||
r == INT16_MIN) r == PG_INT16_MIN)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("smallint out of range"))); errmsg("smallint out of range")));
......
...@@ -101,7 +101,7 @@ int4_dist(PG_FUNCTION_ARGS) ...@@ -101,7 +101,7 @@ int4_dist(PG_FUNCTION_ARGS)
int32 ra; int32 ra;
if (pg_sub_s32_overflow(a, b, &r) || if (pg_sub_s32_overflow(a, b, &r) ||
r == INT32_MIN) r == PG_INT32_MIN)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("integer out of range"))); errmsg("integer out of range")));
......
...@@ -101,7 +101,7 @@ int8_dist(PG_FUNCTION_ARGS) ...@@ -101,7 +101,7 @@ int8_dist(PG_FUNCTION_ARGS)
int64 ra; int64 ra;
if (pg_sub_s64_overflow(a, b, &r) || if (pg_sub_s64_overflow(a, b, &r) ||
r == INT64_MIN) r == PG_INT64_MIN)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("bigint out of range"))); errmsg("bigint out of range")));
......
...@@ -794,7 +794,7 @@ int2div(PG_FUNCTION_ARGS) ...@@ -794,7 +794,7 @@ int2div(PG_FUNCTION_ARGS)
*/ */
if (arg2 == -1) if (arg2 == -1)
{ {
if (unlikely(arg1 == INT16_MIN)) if (unlikely(arg1 == PG_INT16_MIN))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("smallint out of range"))); errmsg("smallint out of range")));
...@@ -1018,7 +1018,7 @@ int4abs(PG_FUNCTION_ARGS) ...@@ -1018,7 +1018,7 @@ int4abs(PG_FUNCTION_ARGS)
int32 arg1 = PG_GETARG_INT32(0); int32 arg1 = PG_GETARG_INT32(0);
int32 result; int32 result;
if (unlikely(arg1 == INT32_MIN)) if (unlikely(arg1 == PG_INT32_MIN))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("integer out of range"))); errmsg("integer out of range")));
...@@ -1032,7 +1032,7 @@ int2abs(PG_FUNCTION_ARGS) ...@@ -1032,7 +1032,7 @@ int2abs(PG_FUNCTION_ARGS)
int16 arg1 = PG_GETARG_INT16(0); int16 arg1 = PG_GETARG_INT16(0);
int16 result; int16 result;
if (unlikely(arg1 == INT16_MIN)) if (unlikely(arg1 == PG_INT16_MIN))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("smallint out of range"))); errmsg("smallint out of range")));
......
...@@ -103,7 +103,7 @@ scanint8(const char *str, bool errorOK, int64 *result) ...@@ -103,7 +103,7 @@ scanint8(const char *str, bool errorOK, int64 *result)
if (!neg) if (!neg)
{ {
if (unlikely(tmp == INT64_MIN)) if (unlikely(tmp == PG_INT64_MIN))
goto out_of_range; goto out_of_range;
tmp = -tmp; tmp = -tmp;
} }
...@@ -564,7 +564,7 @@ int8div(PG_FUNCTION_ARGS) ...@@ -564,7 +564,7 @@ int8div(PG_FUNCTION_ARGS)
*/ */
if (arg2 == -1) if (arg2 == -1)
{ {
if (unlikely(arg1 == INT64_MIN)) if (unlikely(arg1 == PG_INT64_MIN))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("bigint out of range"))); errmsg("bigint out of range")));
...@@ -588,7 +588,7 @@ int8abs(PG_FUNCTION_ARGS) ...@@ -588,7 +588,7 @@ int8abs(PG_FUNCTION_ARGS)
int64 arg1 = PG_GETARG_INT64(0); int64 arg1 = PG_GETARG_INT64(0);
int64 result; int64 result;
if (unlikely(arg1 == INT64_MIN)) if (unlikely(arg1 == PG_INT64_MIN))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("bigint out of range"))); errmsg("bigint out of range")));
...@@ -822,7 +822,7 @@ int84div(PG_FUNCTION_ARGS) ...@@ -822,7 +822,7 @@ int84div(PG_FUNCTION_ARGS)
*/ */
if (arg2 == -1) if (arg2 == -1)
{ {
if (unlikely(arg1 == INT64_MIN)) if (unlikely(arg1 == PG_INT64_MIN))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("bigint out of range"))); errmsg("bigint out of range")));
...@@ -964,7 +964,7 @@ int82div(PG_FUNCTION_ARGS) ...@@ -964,7 +964,7 @@ int82div(PG_FUNCTION_ARGS)
*/ */
if (arg2 == -1) if (arg2 == -1)
{ {
if (unlikely(arg1 == INT64_MIN)) if (unlikely(arg1 == PG_INT64_MIN))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("bigint out of range"))); errmsg("bigint out of range")));
......
...@@ -6226,7 +6226,7 @@ numericvar_to_int64(const NumericVar *var, int64 *result) ...@@ -6226,7 +6226,7 @@ numericvar_to_int64(const NumericVar *var, int64 *result)
if (!neg) if (!neg)
{ {
if (unlikely(val == INT64_MIN)) if (unlikely(val == PG_INT64_MIN))
return false; return false;
val = -val; val = -val;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment