Merge 10.0 into 10.1

This commit is contained in:
Marko Mäkelä 2017-01-05 20:32:15 +02:00
commit 8049d2e9d9
11 changed files with 111 additions and 6 deletions

View file

@ -2169,6 +2169,7 @@ void st_select_lex::init_select()
m_agg_func_used= false;
name_visibility_map= 0;
join= 0;
lock_type= TL_READ_DEFAULT;
}
/*

View file

@ -893,6 +893,9 @@ public:
/* namp of nesting SELECT visibility (for aggregate functions check) */
nesting_map name_visibility_map;
/* it is for correct printing SELECT options */
thr_lock_type lock_type;
void init_query();
void init_select();
st_select_lex_unit* master_unit() { return (st_select_lex_unit*) master; }

View file

@ -25230,6 +25230,12 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
// limit
print_limit(thd, str, query_type);
// lock type
if (lock_type == TL_READ_WITH_SHARED_LOCKS)
str->append(" lock in share mode");
else if (lock_type == TL_WRITE)
str->append(" for update");
// PROCEDURE unsupported here
}

View file

@ -429,6 +429,15 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
lex->link_first_table_back(view, link_to_local);
view->open_type= OT_BASE_ONLY;
/*
ignore lock specs for CREATE statement
*/
if (lex->current_select->lock_type != TL_READ_DEFAULT)
{
lex->current_select->set_lock_for_tables(TL_READ_DEFAULT);
view->mdl_request.set_type(MDL_EXCLUSIVE);
}
if (open_temporary_tables(thd, lex->query_tables) ||
open_and_lock_tables(thd, lex->query_tables, TRUE, 0))
{

View file

@ -8389,12 +8389,14 @@ opt_select_lock_type:
| FOR_SYM UPDATE_SYM
{
LEX *lex=Lex;
lex->current_select->lock_type= TL_WRITE;
lex->current_select->set_lock_for_tables(TL_WRITE);
lex->safe_to_cache_query=0;
}
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
{
LEX *lex=Lex;
lex->current_select->lock_type= TL_READ_WITH_SHARED_LOCKS;
lex->current_select->
set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS);
lex->safe_to_cache_query=0;