1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

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.
This commit is contained in:
Robert Haas
2010-11-20 01:07:04 -05:00
parent b58c25055e
commit 815810ed31
7 changed files with 43 additions and 33 deletions

View File

@ -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;