From 815810ed315a6d21203ec75a11f742f5ed655418 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Sat, 20 Nov 2010 01:07:04 -0500 Subject: Attempt to fix breakage caused by signed integer conversion patch. Use INT_MIN rather than INT32_MIN as we do elsewhere in the code, and try to work around nonexistence of INT64_MIN if necessary. Adjust the new regression tests to something hopefully saner, per observation by Tom Lane. --- src/backend/utils/adt/numutils.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/adt/numutils.c') diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c index 22bcaf78399..635c6ac4e2f 100644 --- a/src/backend/utils/adt/numutils.c +++ b/src/backend/utils/adt/numutils.c @@ -18,6 +18,16 @@ #include #include +/* + * Defining INT64_MIN as -9223372036854775808LL may not work; the compiler's + * tokenizer may see - as a separate token and then be unable to view + * 9223372036854775808 as a number. This is the standard workaround for that + * problem. + */ +#ifndef INT64_MIN +#define INT64_MIN (-9223372036854775807LL - 1) +#endif + #include "utils/builtins.h" /* @@ -136,7 +146,7 @@ pg_ltoa(int32 value, char *a) * Avoid problems with the most negative integer not being representable * as a positive integer. */ - if (value == INT32_MIN) + if (value == INT_MIN) { memcpy(a, "-2147483648", 12); return; -- cgit v1.2.3