diff options
author | Robert Haas <rhaas@postgresql.org> | 2010-11-20 01:07:04 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2010-11-20 01:09:26 -0500 |
commit | 815810ed315a6d21203ec75a11f742f5ed655418 (patch) | |
tree | 3a1bc471fb49fb519e61a348dd112e934d37066a /src/backend/utils/adt/numutils.c | |
parent | b58c25055ef6d7097618c680f6768689a110d529 (diff) | |
download | postgresql-815810ed315a6d21203ec75a11f742f5ed655418.tar.gz postgresql-815810ed315a6d21203ec75a11f742f5ed655418.zip |
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.
Diffstat (limited to 'src/backend/utils/adt/numutils.c')
-rw-r--r-- | src/backend/utils/adt/numutils.c | 12 |
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; |