summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2021-06-25 18:03:29 -0700
committerIgor Babaev <igor@askmonty.org>2021-06-25 18:06:08 -0700
commit12c80df4825955253a1a442098dbceb2a3e59971 (patch)
treee46c52ff81b90df0ce1ff3ee71aaebc1f2509d4f /sql
parent4ad148b148cfbb6f78b33ad9a7662f47c24cb759 (diff)
downloadmariadb-git-12c80df4825955253a1a442098dbceb2a3e59971.tar.gz
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+.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_lex.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 03c06b9ae0f..bdf52e8ef7b 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -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. */