diff options
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index baec470c471..a65acc2c87e 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -769,6 +769,7 @@ void st_parsing_options::reset() { allows_variable= TRUE; + lookup_keywords_after_qualifier= false; } @@ -2144,7 +2145,10 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd) yylval->lex_str.str= (char*) get_ptr(); yylval->lex_str.length= 1; c= yyGet(); // should be '.' - next_state= MY_LEX_IDENT_START; // Next is ident (not keyword) + if (lex->parsing_options.lookup_keywords_after_qualifier) + next_state= MY_LEX_IDENT_OR_KEYWORD; + else + next_state= MY_LEX_IDENT_START; // Next is ident (not keyword) if (!ident_map[(uchar) yyPeek()]) // Probably ` or " next_state= MY_LEX_START; return((int) c); @@ -4791,7 +4795,8 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only) sl->options|= SELECT_DESCRIBE; inner_join->select_options|= SELECT_DESCRIBE; } - res= inner_join->optimize(); + if ((res= inner_join->optimize())) + return TRUE; if (!inner_join->cleaned) sl->update_used_tables(); sl->update_correlated_cache(); @@ -11446,3 +11451,25 @@ bool LEX::sp_create_set_password_instr(THD *thd, sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT; return sp_create_assignment_instr(thd, no_lookahead); } + + +bool LEX::map_data_type(const Lex_ident_sys_st &schema_name, + Lex_field_type_st *type) const +{ + const Schema *schema= schema_name.str ? + Schema::find_by_name(schema_name) : + Schema::find_implied(thd); + if (!schema) + { + char buf[128]; + const Name type_name= type->type_handler()->name(); + my_snprintf(buf, sizeof(buf), "%.*s.%.*s", + (int) schema_name.length, schema_name.str, + (int) type_name.length(), type_name.ptr()); + my_error(ER_UNKNOWN_DATA_TYPE, MYF(0), buf); + return true; + } + const Type_handler *mapped= schema->map_data_type(thd, type->type_handler()); + type->set_handler(mapped); + return false; +} |