diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-04-28 21:27:04 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-04-28 21:27:04 +0200 |
commit | 8f9a72a1504c73a2d432cb5a521b9ca631d1e455 (patch) | |
tree | 7e38cabcb6a91ae37a87a9ff03fe2d3029586dd2 /sql/sql_lex.cc | |
parent | 64b7433709dc5fb5080861018b13a0e1cf9d5238 (diff) | |
download | mariadb-git-8f9a72a1504c73a2d432cb5a521b9ca631d1e455.tar.gz |
MDEV-25501 routine_definition in information_schema.routines loses tablename if it starts with an _ and is not backticked
remove code duplication in Lex_input_stream::scan_ident_middle(),
make sure identifiers are always use the same code path whether
they start form an underscore or not.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 56046584b8b..b1c5327d10c 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2161,6 +2161,11 @@ int Lex_input_stream::scan_ident_middle(THD *thd, Lex_ident_cli_st *str, yySkip(); // next state does a unget } + yyUnget(); // ptr points now after last token char + str->set_ident(m_tok_start, length, is_8bit); + m_cpp_text_start= m_cpp_tok_start; + m_cpp_text_end= m_cpp_text_start + length; + /* Note: "SELECT _bla AS 'alias'" _bla should be considered as a IDENT if charset haven't been found. @@ -2170,28 +2175,17 @@ int Lex_input_stream::scan_ident_middle(THD *thd, Lex_ident_cli_st *str, DBUG_ASSERT(length > 0); if (resolve_introducer && m_tok_start[0] == '_') { - - yyUnget(); // ptr points now after last token char - str->set_ident(m_tok_start, length, false); - - m_cpp_text_start= m_cpp_tok_start; - m_cpp_text_end= m_cpp_text_start + length; - body_utf8_append(m_cpp_text_start, m_cpp_tok_start + length); ErrConvString csname(str->str + 1, str->length - 1, &my_charset_bin); CHARSET_INFO *cs= get_charset_by_csname(csname.ptr(), MY_CS_PRIMARY, MYF(0)); if (cs) { + body_utf8_append(m_cpp_text_start, m_cpp_tok_start + length); *introducer= cs; return UNDERSCORE_CHARSET; } - return IDENT; } - yyUnget(); // ptr points now after last token char - str->set_ident(m_tok_start, length, is_8bit); - m_cpp_text_start= m_cpp_tok_start; - m_cpp_text_end= m_cpp_text_start + length; body_utf8_append(m_cpp_text_start); body_utf8_append_ident(thd, str, m_cpp_text_end); return is_8bit ? IDENT_QUOTED : IDENT; |