1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge tag 'mariadb-10.0.22' into 10.0-galera

This commit is contained in:
Nirbhay Choubey
2015-10-31 18:07:02 -04:00
362 changed files with 9489 additions and 3214 deletions

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2014, SkySQL Ab.
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -58,7 +58,6 @@
#include <my_global.h> /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include "sql_insert.h"
#include "sql_update.h" // compare_record
#include "sql_base.h" // close_thread_tables
@ -3899,7 +3898,6 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
/* Add selected items to field list */
List_iterator_fast<Item> it(*items);
Item *item;
Field *tmp_field;
DBUG_ENTER("create_table_from_items");
tmp_table.alias= 0;
@ -3914,24 +3912,49 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
while ((item=it++))
{
Create_field *cr_field;
Field *field, *def_field;
Field *tmp_table_field;
if (item->type() == Item::FUNC_ITEM)
{
if (item->result_type() != STRING_RESULT)
field= item->tmp_table_field(&tmp_table);
tmp_table_field= item->tmp_table_field(&tmp_table);
else
field= item->tmp_table_field_from_field_type(&tmp_table, 0);
tmp_table_field= item->tmp_table_field_from_field_type(&tmp_table,
false);
}
else
field= create_tmp_field(thd, &tmp_table, item, item->type(),
(Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0,
0);
if (!field ||
!(cr_field=new Create_field(field,(item->type() == Item::FIELD_ITEM ?
((Item_field *)item)->field :
(Field*) 0))))
DBUG_RETURN(0);
{
Field *from_field, * default_field;
tmp_table_field= create_tmp_field(thd, &tmp_table, item, item->type(),
(Item ***) NULL, &from_field, &default_field,
0, 0, 0, 0, 0);
}
if (!tmp_table_field)
DBUG_RETURN(NULL);
Field *table_field;
switch (item->type())
{
/*
We have to take into account both the real table's fields and
pseudo-fields used in trigger's body. These fields are used
to copy defaults values later inside constructor of
the class Create_field.
*/
case Item::FIELD_ITEM:
case Item::TRIGGER_FIELD_ITEM:
table_field= ((Item_field *) item)->field;
break;
default:
table_field= NULL;
}
Create_field *cr_field= new Create_field(tmp_table_field, table_field);
if (!cr_field)
DBUG_RETURN(NULL);
if (item->maybe_null)
cr_field->flags &= ~NOT_NULL_FLAG;
alter_info->create_list.push_back(cr_field);
@ -4021,7 +4044,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
{
if (!thd->is_error()) // CREATE ... IF NOT EXISTS
my_ok(thd); // succeed, but did nothing
DBUG_RETURN(0);
DBUG_RETURN(NULL);
}
DEBUG_SYNC(thd,"create_table_select_before_lock");