diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-01-17 13:59:46 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-01-17 13:59:46 +0100 |
commit | cf925936ecc031355cd56fbd392ec3180517a110 (patch) | |
tree | 0c8961095f9f69eca681c48b47aeac7bdcdcb380 | |
parent | 941460fcf731a32e6a90691508d5cfa3d1f8eeaf (diff) | |
download | postgresql-cf925936ecc031355cd56fbd392ec3180517a110.tar.gz postgresql-cf925936ecc031355cd56fbd392ec3180517a110.zip |
Fix for new Boolean node
The token in nodeTokenType() is actually the whole rest of the string,
so we need to take into account the length to do the correct
comparison.
Without this, postgres_fdw tests fail under
-DWRITE_READ_PARSE_PLAN_TREES.
-rw-r--r-- | src/backend/nodes/read.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/nodes/read.c b/src/backend/nodes/read.c index 8435203f2bd..1e61fde6367 100644 --- a/src/backend/nodes/read.c +++ b/src/backend/nodes/read.c @@ -283,7 +283,8 @@ nodeTokenType(const char *token, int length) retval = RIGHT_PAREN; else if (*token == '{') retval = LEFT_BRACE; - else if (strcmp(token, "true") == 0 || strcmp(token, "false") == 0) + else if ((length == 4 && strncmp(token, "true", 4) == 0) || + (length == 5 && strncmp(token, "false", 5) == 0)) retval = T_Boolean; else if (*token == '"' && length > 1 && token[length - 1] == '"') retval = T_String; |