summaryrefslogtreecommitdiff
path: root/libmariadb
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-04-21 17:34:30 +0200
committerSergei Golubchik <serg@mariadb.org>2022-04-25 21:23:00 +0200
commit3988dfff6234581e80bdeb768058b9ac47078681 (patch)
tree097a8daa31f9402a75dc8d355061d1204de65c04 /libmariadb
parent7753eae1c06044d998318fa3a1dbb98f5a310c57 (diff)
downloadmariadb-git-3988dfff6234581e80bdeb768058b9ac47078681.tar.gz
MDEV-6899 extra semicolon in show create event syntax
to detect the end of SP definition correctly we need to know where the parser stopped parsing the SP. lip->get_cpp_ptr() shows the current parsing position, lip->get_cpp_tok_start() shows the start of the last parsed token. The actual value depends on whether the parser has performed a look-ahead. For example, in CREATE PROCEDURE ... BEGIN ... END ; the parser reads 'END' and knows that this ends the procedure definition, it does not need to read the next token for this. But in CREATE PROCEDURE ... SELECT 1 ; the parser cannot know that the procedure ends at '1'. It has to read the semicolon first (it could be '1 + 2' for example). In the first case, the "current parsing position" is after END, before the semicolon, in the second case it's *after* the semicolon. Note that SP definition in both cases ends before the semicolon. To be able to detect the end of SP deterministically, we need the parser to do the look-ahead always or never. The bug fix introduces a new parser token FORCE_LOOKAHEAD. Lexer never returns it, so this token can never match. But the parser cannot know it so it will have to perform a look-ahead to determine that the next token is not FORCE_LOOKAHEAD. This way we deterministically end SP parsing with a look-ahead.
Diffstat (limited to 'libmariadb')
0 files changed, 0 insertions, 0 deletions