Hi all,

While going through numutils.c I found the following thing:
--- a/src/backend/utils/adt/numutils.c
+++ b/src/backend/utils/adt/numutils.c
@@ -136,7 +136,7 @@ pg_ltoa(int32 value, char *a)
     * Avoid problems with the most negative integer not being representable
     * as a positive integer.
     */
-   if (value == (-2147483647 - 1))
+   if (value == PG_INT32_MIN)
    {
        memcpy(a, "-2147483648", 12);
        return;
Attached is a patch. The interesting part is that pg_lltoa is not
missing the check on PG_INT64_MIN.
Regards,
-- 
Michael
diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c
index c198619..362098e 100644
--- a/src/backend/utils/adt/numutils.c
+++ b/src/backend/utils/adt/numutils.c
@@ -136,7 +136,7 @@ pg_ltoa(int32 value, char *a)
 	 * Avoid problems with the most negative integer not being representable
 	 * as a positive integer.
 	 */
-	if (value == (-2147483647 - 1))
+	if (value == PG_INT32_MIN)
 	{
 		memcpy(a, "-2147483648", 12);
 		return;
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to