diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 354cf7a7b55..093ed597b0a 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -5199,7 +5199,7 @@ void LEX::sp_variable_declarations_init(THD *thd, int nvars) } bool LEX::sp_variable_declarations_finalize(THD *thd, int nvars, - const Lex_field_type_st &type, + const Column_definition &cdef, Item *dflt_value_item) { uint num_vars= spcont->context_var_count(); @@ -5219,7 +5219,7 @@ bool LEX::sp_variable_declarations_finalize(THD *thd, int nvars, return true; if (!last) - spvar->field_def= *last_field; + spvar->field_def= cdef; spvar->default_value= dflt_value_item; spvar->field_def.field_name= spvar->name.str; @@ -5233,7 +5233,7 @@ bool LEX::sp_variable_declarations_finalize(THD *thd, int nvars, sp_instr_set *is= new (this->thd->mem_root) sp_instr_set(sphead->instructions(), spcont, var_idx, dflt_value_item, - type.field_type(), this, last); + spvar->field_def.sql_type, this, last); if (is == NULL || sphead->add_instr(is)) return true; } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 1cc8cf77b35..041a0c8f130 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -3099,7 +3099,7 @@ public: LEX_STRING name); void sp_variable_declarations_init(THD *thd, int nvars); bool sp_variable_declarations_finalize(THD *thd, int nvars, - const Lex_field_type_st &type, + const Column_definition &cdef, Item *def); bool sp_handler_declaration_init(THD *thd, int type); bool sp_handler_declaration_finalize(THD *thd, int type); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 7192df5080f..31fe5cf617e 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2967,7 +2967,8 @@ sp_decl_body: type_with_opt_collate sp_opt_default { - if (Lex->sp_variable_declarations_finalize(thd, $1, $3, $4)) + if (Lex->sp_variable_declarations_finalize(thd, $1, + Lex->last_field[0], $4)) MYSQL_YYABORT; $$.vars= $1; $$.conds= $$.hndlrs= $$.curs= 0; diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index adb0323ebf5..0d1977e59df 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -2373,7 +2373,8 @@ sp_decl_body: type_with_opt_collate sp_opt_default { - if (Lex->sp_variable_declarations_finalize(thd, $1, $3, $4)) + if (Lex->sp_variable_declarations_finalize(thd, $1, + Lex->last_field[0], $4)) MYSQL_YYABORT; $$.vars= $1; $$.conds= $$.hndlrs= $$.curs= 0;