aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/numutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/numutils.c')
-rw-r--r--src/backend/utils/adt/numutils.c12
1 files changed, 11 insertions, 1 deletions
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 <limits.h>
#include <ctype.h>
+/*
+ * 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;