Commit bee85d74 authored by He Zhenxing's avatar He Zhenxing

Auto merge from trunk

parents 84889d03 9c960ecf
...@@ -56,7 +56,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ ...@@ -56,7 +56,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
my_create.lo my_delete.lo mf_tempfile.lo my_open.lo \ my_create.lo my_delete.lo mf_tempfile.lo my_open.lo \
my_file.lo my_read.lo my_write.lo errors.lo \ my_file.lo my_read.lo my_write.lo errors.lo \
my_error.lo my_getwd.lo my_div.lo \ my_error.lo my_getwd.lo my_div.lo \
mf_pack.lo my_messnc.lo mf_dirname.lo mf_fn_ext.lo\ mf_pack.lo my_mess.lo mf_dirname.lo mf_fn_ext.lo\
mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \ mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \
mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \ mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \
my_symlink.lo my_fstream.lo mf_arr_appstr.lo \ my_symlink.lo my_fstream.lo mf_arr_appstr.lo \
......
...@@ -2390,8 +2390,8 @@ SHOW FULL COLUMNS FROM t1; ...@@ -2390,8 +2390,8 @@ SHOW FULL COLUMNS FROM t1;
SET DEBUG_SYNC= "now WAIT_FOR waiting"; SET DEBUG_SYNC= "now WAIT_FOR waiting";
SHOW FULL COLUMNS FROM t1; SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
a char(255) latin1_swedish_ci YES NULL select,insert,update,references a char(255) latin1_swedish_ci YES NULL #
SET DEBUG_SYNC= "now SIGNAL completed"; SET DEBUG_SYNC= "now SIGNAL completed";
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
a char(255) latin1_swedish_ci YES NULL select,insert,update,references a char(255) latin1_swedish_ci YES NULL #
DROP TABLE t1; DROP TABLE t1;
...@@ -277,7 +277,7 @@ t3 CREATE TABLE `t3` ( ...@@ -277,7 +277,7 @@ t3 CREATE TABLE `t3` (
drop table t3,t2,t1; drop table t3,t2,t1;
create table t1 (a int not null, key(a)) engine=merge; create table t1 (a int not null, key(a)) engine=merge;
select * from t1; select * from t1;
ERROR HY000: Got error 124 from storage engine a
drop table t1; drop table t1;
create table t1 (a int not null, b int not null, key(a,b)); create table t1 (a int not null, b int not null, key(a,b));
create table t2 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b));
...@@ -988,6 +988,11 @@ m1 CREATE TABLE `m1` ( ...@@ -988,6 +988,11 @@ m1 CREATE TABLE `m1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, m1; DROP TABLE t1, m1;
CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
SELECT MAX(a) FROM t1;
MAX(a)
NULL
DROP TABLE t1;
CREATE TABLE t1(a INT); CREATE TABLE t1(a INT);
CREATE TABLE t2(a VARCHAR(10)); CREATE TABLE t2(a VARCHAR(10));
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2); CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
......
...@@ -1618,3 +1618,32 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1618,3 +1618,32 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer 1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer
DROP TABLE t1, t2; DROP TABLE t1, t2;
End of 5.1 tests End of 5.1 tests
#
# Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY
# when it should use index
#
CREATE TABLE t1 (i1 integer NOT NULL PRIMARY KEY);
CREATE TABLE t2 (i2 integer NOT NULL PRIMARY KEY);
CREATE TABLE t3 (i3 integer);
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12);
INSERT INTO t2 SELECT * FROM t1;
EXPLAIN EXTENDED
SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2
LEFT JOIN t3 ON t2.i2 = t3.i3
ORDER BY t1.i1 LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 240.00 Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i1 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`i2` = `test`.`t1`.`i1`) order by `test`.`t1`.`i1` limit 5
SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2
LEFT JOIN t3 ON t2.i2 = t3.i3
ORDER BY t1.i1 LIMIT 5;
i1 i2
1 1
2 2
3 3
4 4
5 5
DROP TABLE t1, t2, t3;
...@@ -3479,9 +3479,10 @@ SET DEBUG_SYNC= "get_schema_column SIGNAL waiting WAIT_FOR completed"; ...@@ -3479,9 +3479,10 @@ SET DEBUG_SYNC= "get_schema_column SIGNAL waiting WAIT_FOR completed";
connection default; connection default;
SET DEBUG_SYNC= "now WAIT_FOR waiting"; SET DEBUG_SYNC= "now WAIT_FOR waiting";
--replace_column 8 #
SHOW FULL COLUMNS FROM t1; SHOW FULL COLUMNS FROM t1;
SET DEBUG_SYNC= "now SIGNAL completed"; SET DEBUG_SYNC= "now SIGNAL completed";
--replace_column 8 #
connection con1; connection con1;
--reap --reap
connection default; connection default;
......
...@@ -126,7 +126,6 @@ drop table t3,t2,t1; ...@@ -126,7 +126,6 @@ drop table t3,t2,t1;
# Test table without unions # Test table without unions
# #
create table t1 (a int not null, key(a)) engine=merge; create table t1 (a int not null, key(a)) engine=merge;
--error 1030
select * from t1; select * from t1;
drop table t1; drop table t1;
...@@ -615,6 +614,14 @@ ALTER TABLE m1 UNION=(); ...@@ -615,6 +614,14 @@ ALTER TABLE m1 UNION=();
SHOW CREATE TABLE m1; SHOW CREATE TABLE m1;
DROP TABLE t1, m1; DROP TABLE t1, m1;
#
# BUG#35274 - merge table doesn't need any base tables, gives error 124 when
# key accessed
#
CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
SELECT MAX(a) FROM t1;
DROP TABLE t1;
# #
# BUG#32047 - 'Spurious' errors while opening MERGE tables # BUG#32047 - 'Spurious' errors while opening MERGE tables
# #
......
...@@ -1468,3 +1468,27 @@ SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a; ...@@ -1468,3 +1468,27 @@ SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo End of 5.1 tests --echo End of 5.1 tests
--echo #
--echo # Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY
--echo # when it should use index
--echo #
CREATE TABLE t1 (i1 integer NOT NULL PRIMARY KEY);
CREATE TABLE t2 (i2 integer NOT NULL PRIMARY KEY);
CREATE TABLE t3 (i3 integer);
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12);
INSERT INTO t2 SELECT * FROM t1;
EXPLAIN EXTENDED
SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2
LEFT JOIN t3 ON t2.i2 = t3.i3
ORDER BY t1.i1 LIMIT 5;
SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2
LEFT JOIN t3 ON t2.i2 = t3.i3
ORDER BY t1.i1 LIMIT 5;
DROP TABLE t1, t2, t3;
...@@ -9125,7 +9125,7 @@ void Create_field::create_length_to_internal_length(void) ...@@ -9125,7 +9125,7 @@ void Create_field::create_length_to_internal_length(void)
void Create_field::init_for_tmp_table(enum_field_types sql_type_arg, void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
uint32 length_arg, uint32 decimals_arg, uint32 length_arg, uint32 decimals_arg,
bool maybe_null, bool is_unsigned, bool maybe_null, bool is_unsigned,
uint pack_length) uint pack_length_arg)
{ {
DBUG_ENTER("Create_field::init_for_tmp_table"); DBUG_ENTER("Create_field::init_for_tmp_table");
...@@ -9138,7 +9138,7 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg, ...@@ -9138,7 +9138,7 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
geom_type= Field::GEOM_GEOMETRY; geom_type= Field::GEOM_GEOMETRY;
DBUG_PRINT("enter", ("sql_type: %d, length: %u, pack_length: %u", DBUG_PRINT("enter", ("sql_type: %d, length: %u, pack_length: %u",
sql_type_arg, length_arg, pack_length)); sql_type_arg, length_arg, pack_length_arg));
/* /*
These pack flags are crafted to get it correctly through the These pack flags are crafted to get it correctly through the
...@@ -9202,8 +9202,8 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg, ...@@ -9202,8 +9202,8 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
case MYSQL_TYPE_GEOMETRY: case MYSQL_TYPE_GEOMETRY:
// If you are going to use the above types, you have to pass a // If you are going to use the above types, you have to pass a
// pack_length as parameter. Assert that is really done. // pack_length as parameter. Assert that is really done.
DBUG_ASSERT(pack_length != ~0U); DBUG_ASSERT(pack_length_arg != ~0U);
pack_flag|= pack_length_to_packflag(pack_length); pack_flag|= pack_length_to_packflag(pack_length_arg);
break; break;
default: default:
/* Nothing */ /* Nothing */
......
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. /* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -3434,9 +3434,9 @@ Item_param::set_param_type_and_swap_value(Item_param *src) ...@@ -3434,9 +3434,9 @@ Item_param::set_param_type_and_swap_value(Item_param *src)
bool bool
Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it) Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
{ {
Item *value= *it; Item *arg= *it;
if (value->is_null()) if (arg->is_null())
{ {
set_null(); set_null();
return FALSE; return FALSE;
...@@ -3444,12 +3444,12 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it) ...@@ -3444,12 +3444,12 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
null_value= FALSE; null_value= FALSE;
switch (value->result_type()) { switch (arg->result_type()) {
case STRING_RESULT: case STRING_RESULT:
{ {
char str_buffer[STRING_BUFFER_USUAL_SIZE]; char str_buffer[STRING_BUFFER_USUAL_SIZE];
String sv_buffer(str_buffer, sizeof(str_buffer), &my_charset_bin); String sv_buffer(str_buffer, sizeof(str_buffer), &my_charset_bin);
String *sv= value->val_str(&sv_buffer); String *sv= arg->val_str(&sv_buffer);
if (!sv) if (!sv)
return TRUE; return TRUE;
...@@ -3466,19 +3466,19 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it) ...@@ -3466,19 +3466,19 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
} }
case REAL_RESULT: case REAL_RESULT:
set_double(value->val_real()); set_double(arg->val_real());
param_type= MYSQL_TYPE_DOUBLE; param_type= MYSQL_TYPE_DOUBLE;
break; break;
case INT_RESULT: case INT_RESULT:
set_int(value->val_int(), value->max_length); set_int(arg->val_int(), arg->max_length);
param_type= MYSQL_TYPE_LONG; param_type= MYSQL_TYPE_LONG;
break; break;
case DECIMAL_RESULT: case DECIMAL_RESULT:
{ {
my_decimal dv_buf; my_decimal dv_buf;
my_decimal *dv= value->val_decimal(&dv_buf); my_decimal *dv= arg->val_decimal(&dv_buf);
if (!dv) if (!dv)
return TRUE; return TRUE;
...@@ -3498,8 +3498,8 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it) ...@@ -3498,8 +3498,8 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
return FALSE; return FALSE;
} }
item_result_type= value->result_type(); item_result_type= arg->result_type();
item_type= value->type(); item_type= arg->type();
return FALSE; return FALSE;
} }
......
...@@ -1181,6 +1181,10 @@ class Item { ...@@ -1181,6 +1181,10 @@ class Item {
collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII); collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII);
fix_char_length(max_char_length_arg); fix_char_length(max_char_length_arg);
} }
/*
Return TRUE if the item points to a column of an outer-joined table.
*/
virtual bool is_outer_field() const { DBUG_ASSERT(fixed); return FALSE; }
}; };
...@@ -1694,6 +1698,11 @@ class Item_field :public Item_ident ...@@ -1694,6 +1698,11 @@ class Item_field :public Item_ident
int fix_outer_field(THD *thd, Field **field, Item **reference); int fix_outer_field(THD *thd, Field **field, Item **reference);
virtual Item *update_value_transformer(uchar *select_arg); virtual Item *update_value_transformer(uchar *select_arg);
virtual void print(String *str, enum_query_type query_type); virtual void print(String *str, enum_query_type query_type);
bool is_outer_field() const
{
DBUG_ASSERT(fixed);
return field->table->pos_in_table_list->outer_join;
}
Field::geometry_type get_geometry_type() const Field::geometry_type get_geometry_type() const
{ {
DBUG_ASSERT(field_type() == MYSQL_TYPE_GEOMETRY); DBUG_ASSERT(field_type() == MYSQL_TYPE_GEOMETRY);
...@@ -2506,7 +2515,13 @@ class Item_ref :public Item_ident ...@@ -2506,7 +2515,13 @@ class Item_ref :public Item_ident
DBUG_ASSERT(fixed); DBUG_ASSERT(fixed);
return (*ref)->get_time(ltime); return (*ref)->get_time(ltime);
} }
bool basic_const_item() { return (*ref)->basic_const_item(); } virtual bool basic_const_item() const { return (*ref)->basic_const_item(); }
bool is_outer_field() const
{
DBUG_ASSERT(fixed);
DBUG_ASSERT(ref);
return (*ref)->is_outer_field();
}
}; };
...@@ -3367,6 +3382,7 @@ class Item_cache_datetime: public Item_cache ...@@ -3367,6 +3382,7 @@ class Item_cache_datetime: public Item_cache
cmp_context= STRING_RESULT; cmp_context= STRING_RESULT;
} }
virtual void store(Item *item) { Item_cache::store(item); }
void store(Item *item, longlong val_arg); void store(Item *item, longlong val_arg);
double val_real(); double val_real();
longlong val_int(); longlong val_int();
......
...@@ -5466,7 +5466,21 @@ void Item_equal::update_const() ...@@ -5466,7 +5466,21 @@ void Item_equal::update_const()
Item *item; Item *item;
while ((item= it++)) while ((item= it++))
{ {
if (item->const_item()) if (item->const_item() &&
/*
Don't propagate constant status of outer-joined column.
Such a constant status here is a result of:
a) empty outer-joined table: in this case such a column has a
value of NULL; but at the same time other arguments of
Item_equal don't have to be NULLs and the value of the whole
multiple equivalence expression doesn't have to be NULL or FALSE
because of the outer join nature;
or
b) outer-joined table contains only 1 row: the result of
this column is equal to a row field value *or* NULL.
Both values are inacceptable as Item_equal constants.
*/
!item->is_outer_field())
{ {
it.remove(); it.remove();
add(item); add(item);
...@@ -5505,7 +5519,8 @@ void Item_equal::update_used_tables() ...@@ -5505,7 +5519,8 @@ void Item_equal::update_used_tables()
{ {
item->update_used_tables(); item->update_used_tables();
used_tables_cache|= item->used_tables(); used_tables_cache|= item->used_tables();
const_item_cache&= item->const_item(); /* see commentary at Item_equal::update_const() */
const_item_cache&= item->const_item() && !item->is_outer_field();
} }
} }
......
...@@ -303,6 +303,8 @@ class st_select_lex; ...@@ -303,6 +303,8 @@ class st_select_lex;
class Item_sum :public Item_result_field class Item_sum :public Item_result_field
{ {
friend class Aggregator_distinct;
protected: protected:
/** /**
Aggregator class instance. Not set initially. Allocated only after Aggregator class instance. Not set initially. Allocated only after
......
/* Copyright (C) 2006-2008 MySQL AB, Sun Microsystems Inc. 2008-2009 /* Copyright (c) 2006, 2010 Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -603,12 +603,12 @@ bool partition_info::check_engine_mix(handlerton *engine_type, ...@@ -603,12 +603,12 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
{ {
handlerton *old_engine_type= engine_type; handlerton *old_engine_type= engine_type;
bool first= TRUE; bool first= TRUE;
uint num_parts= partitions.elements; uint n_parts= partitions.elements;
DBUG_ENTER("partition_info::check_engine_mix"); DBUG_ENTER("partition_info::check_engine_mix");
DBUG_PRINT("info", ("in: engine_type = %s, table_engine_set = %u", DBUG_PRINT("info", ("in: engine_type = %s, table_engine_set = %u",
ha_resolve_storage_engine_name(engine_type), ha_resolve_storage_engine_name(engine_type),
table_engine_set)); table_engine_set));
if (num_parts) if (n_parts)
{ {
List_iterator<partition_element> part_it(partitions); List_iterator<partition_element> part_it(partitions);
uint i= 0; uint i= 0;
...@@ -621,7 +621,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type, ...@@ -621,7 +621,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
if (is_sub_partitioned() && if (is_sub_partitioned() &&
part_elem->subpartitions.elements) part_elem->subpartitions.elements)
{ {
uint num_subparts= part_elem->subpartitions.elements; uint n_subparts= part_elem->subpartitions.elements;
uint j= 0; uint j= 0;
List_iterator<partition_element> sub_it(part_elem->subpartitions); List_iterator<partition_element> sub_it(part_elem->subpartitions);
do do
...@@ -633,7 +633,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type, ...@@ -633,7 +633,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
if (check_engine_condition(sub_elem, table_engine_set, if (check_engine_condition(sub_elem, table_engine_set,
&engine_type, &first)) &engine_type, &first))
goto error; goto error;
} while (++j < num_subparts); } while (++j < n_subparts);
/* ensure that the partition also has correct engine */ /* ensure that the partition also has correct engine */
if (check_engine_condition(part_elem, table_engine_set, if (check_engine_condition(part_elem, table_engine_set,
&engine_type, &first)) &engine_type, &first))
...@@ -642,7 +642,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type, ...@@ -642,7 +642,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
else if (check_engine_condition(part_elem, table_engine_set, else if (check_engine_condition(part_elem, table_engine_set,
&engine_type, &first)) &engine_type, &first))
goto error; goto error;
} while (++i < num_parts); } while (++i < n_parts);
} }
DBUG_PRINT("info", ("engine_type = %s", DBUG_PRINT("info", ("engine_type = %s",
ha_resolve_storage_engine_name(engine_type))); ha_resolve_storage_engine_name(engine_type)));
...@@ -1315,15 +1315,15 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, ...@@ -1315,15 +1315,15 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
RETURN VALUES RETURN VALUES
*/ */
void partition_info::print_no_partition_found(TABLE *table) void partition_info::print_no_partition_found(TABLE *table_arg)
{ {
char buf[100]; char buf[100];
char *buf_ptr= (char*)&buf; char *buf_ptr= (char*)&buf;
TABLE_LIST table_list; TABLE_LIST table_list;
bzero(&table_list, sizeof(table_list)); bzero(&table_list, sizeof(table_list));
table_list.db= table->s->db.str; table_list.db= table_arg->s->db.str;
table_list.table_name= table->s->table_name.str; table_list.table_name= table_arg->s->table_name.str;
if (check_single_table_access(current_thd, if (check_single_table_access(current_thd,
SELECT_ACL, &table_list, TRUE)) SELECT_ACL, &table_list, TRUE))
...@@ -1337,13 +1337,13 @@ void partition_info::print_no_partition_found(TABLE *table) ...@@ -1337,13 +1337,13 @@ void partition_info::print_no_partition_found(TABLE *table)
buf_ptr= (char*)"from column_list"; buf_ptr= (char*)"from column_list";
else else
{ {
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set); my_bitmap_map *old_map= dbug_tmp_use_all_columns(table_arg, table_arg->read_set);
if (part_expr->null_value) if (part_expr->null_value)
buf_ptr= (char*)"NULL"; buf_ptr= (char*)"NULL";
else else
longlong2str(err_value, buf, longlong2str(err_value, buf,
part_expr->unsigned_flag ? 10 : -10); part_expr->unsigned_flag ? 10 : -10);
dbug_tmp_restore_column_map(table->read_set, old_map); dbug_tmp_restore_column_map(table_arg->read_set, old_map);
} }
my_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, MYF(0), buf_ptr); my_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, MYF(0), buf_ptr);
} }
...@@ -2003,7 +2003,7 @@ bool partition_info::fix_column_value_functions(THD *thd, ...@@ -2003,7 +2003,7 @@ bool partition_info::fix_column_value_functions(THD *thd,
part_elem_value *val, part_elem_value *val,
uint part_id) uint part_id)
{ {
uint num_columns= part_field_list.elements; uint n_columns= part_field_list.elements;
bool result= FALSE; bool result= FALSE;
uint i; uint i;
part_column_list_val *col_val= val->col_val_array; part_column_list_val *col_val= val->col_val_array;
...@@ -2013,7 +2013,7 @@ bool partition_info::fix_column_value_functions(THD *thd, ...@@ -2013,7 +2013,7 @@ bool partition_info::fix_column_value_functions(THD *thd,
{ {
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
for (i= 0; i < num_columns; col_val++, i++) for (i= 0; i < n_columns; col_val++, i++)
{ {
Item *column_item= col_val->item_expression; Item *column_item= col_val->item_expression;
Field *field= part_field_array[i]; Field *field= part_field_array[i];
......
/* Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc /* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -1708,7 +1708,7 @@ bool READ_INFO::find_start_of_fields() ...@@ -1708,7 +1708,7 @@ bool READ_INFO::find_start_of_fields()
/* /*
Clear taglist from tags with a specified level Clear taglist from tags with a specified level
*/ */
int READ_INFO::clear_level(int level) int READ_INFO::clear_level(int level_arg)
{ {
DBUG_ENTER("READ_INFO::read_xml clear_level"); DBUG_ENTER("READ_INFO::read_xml clear_level");
List_iterator<XML_TAG> xmlit(taglist); List_iterator<XML_TAG> xmlit(taglist);
...@@ -1717,7 +1717,7 @@ int READ_INFO::clear_level(int level) ...@@ -1717,7 +1717,7 @@ int READ_INFO::clear_level(int level)
while ((tag= xmlit++)) while ((tag= xmlit++))
{ {
if(tag->level >= level) if(tag->level >= level_arg)
{ {
xmlit.remove(); xmlit.remove();
delete tag; delete tag;
......
...@@ -65,7 +65,17 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag) ...@@ -65,7 +65,17 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag)
} }
} }
else else
my_errno= error= HA_ERR_WRONG_INDEX; {
/*
inx may be bigger than info->keys if there are no underlying tables
defined. In this case we should return empty result. As we check for
underlying tables conformance when we open a table, we may not enter
this branch with underlying table that has less keys than merge table
have.
*/
DBUG_ASSERT(!info->tables);
error= my_errno= HA_ERR_END_OF_FILE;
}
return error; return error;
} }
......
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