mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
This commit is contained in:
@ -155,6 +155,35 @@ err:
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check if auto generated column names are conforming and
|
||||
possibly generate a conforming name for them if not.
|
||||
|
||||
@param item_list List of Items which should be checked
|
||||
*/
|
||||
|
||||
static void make_valid_column_names(List<Item> &item_list)
|
||||
{
|
||||
Item *item;
|
||||
uint name_len;
|
||||
List_iterator_fast<Item> it(item_list);
|
||||
char buff[NAME_LEN];
|
||||
DBUG_ENTER("make_valid_column_names");
|
||||
|
||||
for (uint column_no= 1; (item= it++); column_no++)
|
||||
{
|
||||
if (!item->is_autogenerated_name || !check_column_name(item->name))
|
||||
continue;
|
||||
name_len= my_snprintf(buff, NAME_LEN, "Name_exp_%u", column_no);
|
||||
item->orig_name= item->name;
|
||||
item->set_name(buff, name_len, system_charset_info);
|
||||
}
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Fill defined view parts
|
||||
|
||||
@ -400,17 +429,14 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
||||
DBUG_ASSERT(!lex->proc_list.first && !lex->result &&
|
||||
!lex->param_list.elements);
|
||||
|
||||
if (mode != VIEW_CREATE_NEW)
|
||||
if (mode == VIEW_ALTER && fill_defined_view_parts(thd, view))
|
||||
{
|
||||
if (mode == VIEW_ALTER &&
|
||||
fill_defined_view_parts(thd, view))
|
||||
{
|
||||
res= TRUE;
|
||||
goto err;
|
||||
}
|
||||
sp_cache_invalidate();
|
||||
res= TRUE;
|
||||
goto err;
|
||||
}
|
||||
|
||||
sp_cache_invalidate();
|
||||
|
||||
if (!lex->definer)
|
||||
{
|
||||
/*
|
||||
@ -551,6 +577,9 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the auto generated column names are conforming. */
|
||||
make_valid_column_names(select_lex->item_list);
|
||||
|
||||
if (check_duplicate_names(select_lex->item_list, 1))
|
||||
{
|
||||
res= TRUE;
|
||||
|
Reference in New Issue
Block a user