-
Marc Alff authored
Before this fix, the NULL token was not properly parsed when computing query digests. In some contexts where NULL is an expression, the NULL token was not replaced by a '?' token. In other contexts, where NULL was followed by a ',' and then by another literal, the digest code always reduced this to an expression list, which may not be correct due to context. For example, SELECT a IS NULL, 2 contains "NULL", ",", "2" but the last 3 tokens are not an expression list, because the NULL alone is not an expression. The root cause is that the NULL token may or may not be a literal depending on the grammar context, but the code only uses the token returned by the lexer (not the parser) to compute digests, and therefore lacks context to make the proper decision. The fix is to explicitly reduce NULL to a '?' generic value only when an actual literal is found in the parser itself, which takes care of reducing NULL only in the proper context.
Marc Alff authoredBefore this fix, the NULL token was not properly parsed when computing query digests. In some contexts where NULL is an expression, the NULL token was not replaced by a '?' token. In other contexts, where NULL was followed by a ',' and then by another literal, the digest code always reduced this to an expression list, which may not be correct due to context. For example, SELECT a IS NULL, 2 contains "NULL", ",", "2" but the last 3 tokens are not an expression list, because the NULL alone is not an expression. The root cause is that the NULL token may or may not be a literal depending on the grammar context, but the code only uses the token returned by the lexer (not the parser) to compute digests, and therefore lacks context to make the proper decision. The fix is to explicitly reduce NULL to a '?' generic value only when an actual literal is found in the parser itself, which takes care of reducing NULL only in the proper context.
Loading