1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-20411 Procedure containing CTE incorrectly stored in mysql.proc

If the first token of the body of a stored procedure was 'WITH' then
the beginning of the body was determined incorrectly and that token was
missing in the string representing the body of the SP in mysql.proc. As a
resultnany call of such procedure failed as the string representing the
body could not be parsed.

The patch corrects the code of the functions get_tok_start() and
get_cpp_tok_start() of the class Lex_input_stream to make them take into
account look ahead tokens. The patch is needed only for 10.2 as this
problem has neen resolved in 10.3+.
This commit is contained in:
Igor Babaev
2021-06-25 18:03:29 -07:00
parent 4ad148b148
commit 12c80df482
4 changed files with 87 additions and 3 deletions

View File

@ -2176,7 +2176,7 @@ public:
/** Get the token start position, in the raw buffer. */
const char *get_tok_start()
{
return m_tok_start;
return lookahead_token >= 0 ? m_tok_start_prev : m_tok_start;
}
void set_cpp_tok_start(const char *pos)
@ -2222,7 +2222,7 @@ public:
/** Get the token start position, in the pre-processed buffer. */
const char *get_cpp_tok_start()
{
return m_cpp_tok_start;
return lookahead_token >= 0 ? m_cpp_tok_start_prev : m_cpp_tok_start;
}
/** Get the token end position, in the pre-processed buffer. */