Commit b58098c3 authored by serg@serg.mylan's avatar serg@serg.mylan

bug #1434 (and related issues)

parent 2667d7f8
......@@ -129,8 +129,28 @@ insert into t1 values ("a", 1), ("b", 2);
drop table t1;
#
# Bug # 801
# Bug #801
#
create table t1 select x'4132';
drop table t1;
#
# bug #1434
#
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
--error 1136
create table if not exists t1 select 1,2,3,4;
create table if not exists t1 select 1;
select * from t1;
drop table t1;
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
--error 1136
create table if not exists t1 select 1,2,3,4;
create table if not exists t1 select 1;
select * from t1;
drop table t1;
......@@ -703,6 +703,7 @@ class select_create: public select_insert {
HA_CREATE_INFO *create_info;
MYSQL_LOCK *lock;
Field **field;
my_bool do_not_drop;
public:
select_create (const char *db_name, const char *table_name,
HA_CREATE_INFO *create_info_par,
......@@ -711,8 +712,7 @@ public:
List<Item> &select_fields,enum_duplicates duplic)
:select_insert (NULL, &select_fields, duplic), db(db_name),
name(table_name), extra_fields(&fields_par),keys(&keys_par),
create_info(create_info_par),
lock(0)
create_info(create_info_par), lock(0), do_not_drop(0)
{}
int prepare(List<Item> &list);
bool send_data(List<Item> &values);
......
......@@ -1438,6 +1438,15 @@ select_create::prepare(List<Item> &values)
if (!table)
DBUG_RETURN(-1); // abort() deletes table
if (table->fields < values.elements)
{
do_not_drop=1;
my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
ER(ER_WRONG_VALUE_COUNT_ON_ROW),
MYF(0),1);
DBUG_RETURN(-1);
}
/* First field to copy */
field=table->field+table->fields - values.elements;
......@@ -1519,6 +1528,7 @@ void select_create::abort()
enum db_type table_type=table->db_type;
if (!table->tmp_table)
hash_delete(&open_cache,(byte*) table);
if (!do_not_drop)
quick_rm_table(table_type,db,name);
table=0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment