]> granicus.if.org Git - postgresql/blobdiff - src/backend/nodes/read.c
Change internal integer representation of Value node
[postgresql] / src / backend / nodes / read.c
index 0dabfa7dc9bf4de21762b4bb4ba9e53a25e9b3cc..6e9fa45e37e37ff91c000e48d844d629b2b69f18 100644 (file)
@@ -4,7 +4,7 @@
  *       routines to convert a string (legal ascii representation of node) back
  *       to nodes
  *
- * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
@@ -224,13 +224,9 @@ nodeTokenType(char *token, int length)
 
                errno = 0;
                val = strtol(token, &endptr, 10);
-               (void) val;                             /* avoid compiler warning if unused */
-               if (endptr != token + length || errno == ERANGE
-#ifdef HAVE_LONG_INT_64
-               /* if long > 32 bits, check for overflow of int4 */
-                       || val != (long) ((int32) val)
-#endif
-                       )
+               if (endptr != token + length || errno == ERANGE ||
+                       /* check for overflow of int */
+                       val != (int) val)
                        return T_Float;
                return T_Integer;
        }
@@ -245,7 +241,7 @@ nodeTokenType(char *token, int length)
                retval = RIGHT_PAREN;
        else if (*token == '{')
                retval = LEFT_BRACE;
-       else if (*token == '\"' && length > 1 && token[length - 1] == '\"')
+       else if (*token == '"' && length > 1 && token[length - 1] == '"')
                retval = T_String;
        else if (*token == 'b')
                retval = T_BitString;
@@ -387,9 +383,9 @@ nodeRead(char *token, int tok_len)
                case T_Integer:
 
                        /*
-                        * we know that the token terminates on a char atol will stop at
+                        * we know that the token terminates on a char atoi will stop at
                         */
-                       result = (Node *) makeInteger(atol(token));
+                       result = (Node *) makeInteger(atoi(token));
                        break;
                case T_Float:
                        {