Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 43f4b34

Browse files
committed
Fix reading of most-negative integer value nodes
The main parser checks whether a literal fits into an int when deciding whether it should be put into an Integer or Float node. The parser processes integer literals without signs. So a most-negative integer literal will not fit into Integer and will end up as a Float node. The node tokenizer did this differently. It included the sign when checking whether the literal fit into int. So a most-negative integer would indeed fit that way and end up as an Integer node. In order to preserve the node structure correctly, we need the node tokenizer to also analyze integer literals without sign. There are a number of test cases in the regression tests that have a most-negative integer argument of some utility statement, so this issue is easily reproduced under WRITE_READ_PARSE_PLAN_TREES. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us
1 parent 03bf971 commit 43f4b34

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/nodes/read.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ nodeTokenType(const char *token, int length)
267267
char *endptr;
268268

269269
errno = 0;
270-
(void) strtoint(token, &endptr, 10);
270+
(void) strtoint(numptr, &endptr, 10);
271271
if (endptr != token + length || errno == ERANGE)
272272
return T_Float;
273273
return T_Integer;

0 commit comments

Comments
 (0)