Commit 54f9d44b authored by serg@serg.mylan's avatar serg@serg.mylan

merged

parents 9c4049ad 2dadbb31
...@@ -296,5 +296,6 @@ ...@@ -296,5 +296,6 @@
#define ER_MISSING_SKIP_SLAVE 1277 #define ER_MISSING_SKIP_SLAVE 1277
#define ER_UNTIL_COND_IGNORED 1278 #define ER_UNTIL_COND_IGNORED 1278
#define ER_WRONG_INDEX_NAME 1279 #define ER_WRONG_INDEX_NAME 1279
#define ER_BAD_FT_COLUMN 1280 #define ER_WARN_QC_RESIZE 1280
#define ER_ERROR_MESSAGES 281 #define ER_BAD_FT_COLUMN 1281
#define ER_ERROR_MESSAGES 282
...@@ -579,24 +579,32 @@ query_cache_size 0 ...@@ -579,24 +579,32 @@ query_cache_size 0
select * from t1; select * from t1;
a a
set GLOBAL query_cache_size=1024; set GLOBAL query_cache_size=1024;
Warnings:
Warning 1280 Query cache failed to set size 1024, new query cache size is 0
show global variables like "query_cache_size"; show global variables like "query_cache_size";
Variable_name Value Variable_name Value
query_cache_size 0 query_cache_size 0
select * from t1; select * from t1;
a a
set GLOBAL query_cache_size=10240; set GLOBAL query_cache_size=10240;
Warnings:
Warning 1280 Query cache failed to set size 10240, new query cache size is 0
show global variables like "query_cache_size"; show global variables like "query_cache_size";
Variable_name Value Variable_name Value
query_cache_size 0 query_cache_size 0
select * from t1; select * from t1;
a a
set GLOBAL query_cache_size=20480; set GLOBAL query_cache_size=20480;
Warnings:
Warning 1280 Query cache failed to set size 20480, new query cache size is 0
show global variables like "query_cache_size"; show global variables like "query_cache_size";
Variable_name Value Variable_name Value
query_cache_size 0 query_cache_size 0
select * from t1; select * from t1;
a a
set GLOBAL query_cache_size=40960; set GLOBAL query_cache_size=40960;
Warnings:
Warning 1280 Query cache failed to set size 40960, new query cache size is 0
show global variables like "query_cache_size"; show global variables like "query_cache_size";
Variable_name Value Variable_name Value
query_cache_size 0 query_cache_size 0
......
...@@ -1489,3 +1489,17 @@ set sort_buffer_size = (select s1 from t1); ...@@ -1489,3 +1489,17 @@ set sort_buffer_size = (select s1 from t1);
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
do (select * from t1); do (select * from t1);
drop table t1; drop table t1;
create table t1 (s1 char);
insert into t1 values ('e');
select * from t1 where 'f' > any (select s1 from t1);
s1
e
select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
s1
e
explain select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY t1 system NULL NULL NULL NULL 1
3 UNION t1 system NULL NULL NULL NULL 1
drop table t1;
...@@ -1010,3 +1010,13 @@ insert into t1 values (2); ...@@ -1010,3 +1010,13 @@ insert into t1 values (2);
set sort_buffer_size = (select s1 from t1); set sort_buffer_size = (select s1 from t1);
do (select * from t1); do (select * from t1);
drop table t1; drop table t1;
#
# optimized ALL/ANY with union
#
create table t1 (s1 char);
insert into t1 values ('e');
select * from t1 where 'f' > any (select s1 from t1);
select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
explain select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
drop table t1;
...@@ -421,6 +421,7 @@ bool Item_in_optimizer::fix_left(THD *thd, ...@@ -421,6 +421,7 @@ bool Item_in_optimizer::fix_left(THD *thd,
not_null_tables_cache= args[0]->not_null_tables(); not_null_tables_cache= args[0]->not_null_tables();
with_sum_func= args[0]->with_sum_func; with_sum_func= args[0]->with_sum_func;
const_item_cache= args[0]->const_item(); const_item_cache= args[0]->const_item();
fixed= 1;
return 0; return 0;
} }
......
...@@ -35,7 +35,7 @@ inline Item * and_items(Item* cond, Item *item) ...@@ -35,7 +35,7 @@ inline Item * and_items(Item* cond, Item *item)
} }
Item_subselect::Item_subselect(): Item_subselect::Item_subselect():
Item_result_field(), engine_owner(1), value_assigned(0), substitution(0), Item_result_field(), value_assigned(0), substitution(0),
engine(0), used_tables_cache(0), have_to_be_excluded(0), engine(0), used_tables_cache(0), have_to_be_excluded(0),
const_item_cache(1), engine_changed(0) const_item_cache(1), engine_changed(0)
{ {
...@@ -66,7 +66,6 @@ void Item_subselect::init(st_select_lex *select_lex, ...@@ -66,7 +66,6 @@ void Item_subselect::init(st_select_lex *select_lex,
Item_subselect::~Item_subselect() Item_subselect::~Item_subselect()
{ {
if (engine_owner)
delete engine; delete engine;
} }
...@@ -183,7 +182,8 @@ Item_singlerow_subselect::Item_singlerow_subselect(st_select_lex *select_lex) ...@@ -183,7 +182,8 @@ Item_singlerow_subselect::Item_singlerow_subselect(st_select_lex *select_lex)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
Item_maxmin_subselect::Item_maxmin_subselect(st_select_lex *select_lex, Item_maxmin_subselect::Item_maxmin_subselect(Item_subselect *parent,
st_select_lex *select_lex,
bool max) bool max)
:Item_singlerow_subselect() :Item_singlerow_subselect()
{ {
...@@ -192,6 +192,14 @@ Item_maxmin_subselect::Item_maxmin_subselect(st_select_lex *select_lex, ...@@ -192,6 +192,14 @@ Item_maxmin_subselect::Item_maxmin_subselect(st_select_lex *select_lex,
max_columns= 1; max_columns= 1;
maybe_null= 1; maybe_null= 1;
max_columns= 1; max_columns= 1;
/*
Following information was collected during performing fix_fields()
of Items belonged to subquery, which will be not repeated
*/
used_tables_cache= parent->get_used_tables_cache();
const_item_cache= parent->get_const_item_cache();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -527,9 +535,16 @@ Item_in_subselect::single_value_transformer(JOIN *join, ...@@ -527,9 +535,16 @@ Item_in_subselect::single_value_transformer(JOIN *join,
func == &Item_bool_func2::ge_creator || func == &Item_bool_func2::ge_creator ||
func == &Item_bool_func2::le_creator)) func == &Item_bool_func2::le_creator))
{ {
if (substitution)
{
// It is second (third, ...) SELECT of UNION => All is done
DBUG_RETURN(RES_OK);
}
Item *subs; Item *subs;
if (!select_lex->group_list.elements && if (!select_lex->group_list.elements &&
!select_lex->with_sum_func) !select_lex->with_sum_func &&
!(select_lex->next_select()))
{ {
Item *item; Item *item;
subs_type type= substype(); subs_type type= substype();
...@@ -565,7 +580,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, ...@@ -565,7 +580,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
// remove LIMIT placed by ALL/ANY subquery // remove LIMIT placed by ALL/ANY subquery
select_lex->master_unit()->global_parameters->select_limit= select_lex->master_unit()->global_parameters->select_limit=
HA_POS_ERROR; HA_POS_ERROR;
subs= new Item_maxmin_subselect(select_lex, subs= new Item_maxmin_subselect(this, select_lex,
(func == &Item_bool_func2::le_creator || (func == &Item_bool_func2::le_creator ||
func == &Item_bool_func2::lt_creator)); func == &Item_bool_func2::lt_creator));
} }
......
...@@ -33,7 +33,6 @@ typedef Item_bool_func2* (*compare_func_creator)(Item*, Item*); ...@@ -33,7 +33,6 @@ typedef Item_bool_func2* (*compare_func_creator)(Item*, Item*);
class Item_subselect :public Item_result_field class Item_subselect :public Item_result_field
{ {
my_bool engine_owner; /* Is this item owner of engine */
my_bool value_assigned; /* value already assigned to subselect */ my_bool value_assigned; /* value already assigned to subselect */
protected: protected:
/* thread handler, will be assigned in fix_fields only */ /* thread handler, will be assigned in fix_fields only */
...@@ -90,6 +89,8 @@ class Item_subselect :public Item_result_field ...@@ -90,6 +89,8 @@ class Item_subselect :public Item_result_field
virtual void fix_length_and_dec(); virtual void fix_length_and_dec();
table_map used_tables() const; table_map used_tables() const;
bool const_item() const; bool const_item() const;
inline table_map get_used_tables_cache() { return used_tables_cache; }
inline bool get_const_item_cache() { return const_item_cache; }
void update_used_tables(); void update_used_tables();
void print(String *str) void print(String *str)
{ {
...@@ -144,10 +145,11 @@ class Item_singlerow_subselect :public Item_subselect ...@@ -144,10 +145,11 @@ class Item_singlerow_subselect :public Item_subselect
}; };
/* used in static ALL/ANY optimisation */ /* used in static ALL/ANY optimisation */
class Item_maxmin_subselect: public Item_singlerow_subselect class Item_maxmin_subselect :public Item_singlerow_subselect
{ {
public: public:
Item_maxmin_subselect(st_select_lex *select_lex, bool max); Item_maxmin_subselect(Item_subselect *parent,
st_select_lex *select_lex, bool max);
}; };
/* exists subselect */ /* exists subselect */
......
...@@ -1822,7 +1822,7 @@ bool Item_func_group_concat::setup(THD *thd) ...@@ -1822,7 +1822,7 @@ bool Item_func_group_concat::setup(THD *thd)
if (select_lex->linkage == GLOBAL_OPTIONS_TYPE) if (select_lex->linkage == GLOBAL_OPTIONS_TYPE)
DBUG_RETURN(1); DBUG_RETURN(1);
/* /*
all not constant fields are push to list and create temp table push all not constant fields to list and create temp table
*/ */
always_null= 0; always_null= 0;
for (uint i= 0; i < arg_count; i++) for (uint i= 0; i < arg_count; i++)
......
...@@ -909,7 +909,12 @@ static void fix_net_retry_count(THD *thd __attribute__(unused), ...@@ -909,7 +909,12 @@ static void fix_net_retry_count(THD *thd __attribute__(unused),
static void fix_query_cache_size(THD *thd, enum_var_type type) static void fix_query_cache_size(THD *thd, enum_var_type type)
{ {
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
ulong requested= query_cache_size;
query_cache.resize(query_cache_size); query_cache.resize(query_cache_size);
if (requested != query_cache_size)
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_QC_RESIZE, ER(ER_WARN_QC_RESIZE),
requested, query_cache_size);
#endif #endif
} }
......
...@@ -292,4 +292,5 @@ character-set=latin2 ...@@ -292,4 +292,5 @@ character-set=latin2
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -286,4 +286,5 @@ character-set=latin1 ...@@ -286,4 +286,5 @@ character-set=latin1
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -294,4 +294,5 @@ character-set=latin1 ...@@ -294,4 +294,5 @@ character-set=latin1
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -283,4 +283,5 @@ character-set=latin1 ...@@ -283,4 +283,5 @@ character-set=latin1
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -288,4 +288,5 @@ character-set=latin7 ...@@ -288,4 +288,5 @@ character-set=latin7
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -283,4 +283,5 @@ character-set=latin1 ...@@ -283,4 +283,5 @@ character-set=latin1
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -295,4 +295,5 @@ character-set=latin1 ...@@ -295,4 +295,5 @@ character-set=latin1
"Es wird empfohlen, mit --skip-slave-start zu starten, wenn mit START SLAVE UNTIL eine Schritt-für-Schritt-Replikation ausgeführt wird. Ansonsten gibt es Probleme, wenn der Slave-Server unerwartet neu startet", "Es wird empfohlen, mit --skip-slave-start zu starten, wenn mit START SLAVE UNTIL eine Schritt-für-Schritt-Replikation ausgeführt wird. Ansonsten gibt es Probleme, wenn der Slave-Server unerwartet neu startet",
"SQL-Thread soll nicht gestartet werden. Daher werden UNTIL-Optionen ignoriert" "SQL-Thread soll nicht gestartet werden. Daher werden UNTIL-Optionen ignoriert"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -283,4 +283,5 @@ character-set=greek ...@@ -283,4 +283,5 @@ character-set=greek
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -285,4 +285,5 @@ character-set=latin2 ...@@ -285,4 +285,5 @@ character-set=latin2
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -283,4 +283,5 @@ character-set=latin1 ...@@ -283,4 +283,5 @@ character-set=latin1
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -285,4 +285,5 @@ character-set=ujis ...@@ -285,4 +285,5 @@ character-set=ujis
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -283,4 +283,5 @@ character-set=euckr ...@@ -283,4 +283,5 @@ character-set=euckr
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -285,4 +285,5 @@ character-set=latin1 ...@@ -285,4 +285,5 @@ character-set=latin1
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -285,4 +285,5 @@ character-set=latin1 ...@@ -285,4 +285,5 @@ character-set=latin1
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -287,4 +287,5 @@ character-set=latin2 ...@@ -287,4 +287,5 @@ character-set=latin2
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -284,4 +284,5 @@ character-set=latin1 ...@@ -284,4 +284,5 @@ character-set=latin1
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -287,4 +287,5 @@ character-set=latin2 ...@@ -287,4 +287,5 @@ character-set=latin2
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -285,4 +285,5 @@ character-set=koi8r ...@@ -285,4 +285,5 @@ character-set=koi8r
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
" %lu, - %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -278,4 +278,5 @@ character-set=cp1250 ...@@ -278,4 +278,5 @@ character-set=cp1250
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -291,4 +291,5 @@ character-set=latin2 ...@@ -291,4 +291,5 @@ character-set=latin2
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -285,4 +285,5 @@ character-set=latin1 ...@@ -285,4 +285,5 @@ character-set=latin1
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -283,4 +283,5 @@ character-set=latin1 ...@@ -283,4 +283,5 @@ character-set=latin1
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
"Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -288,4 +288,5 @@ character-set=koi8u ...@@ -288,4 +288,5 @@ character-set=koi8u
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'", "Incorrect index name '%-.100s'",
" Ԧ ͦ %lu, ͦ Ԧ - %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index"
...@@ -1112,8 +1112,11 @@ void st_select_lex_unit::exclude_level() ...@@ -1112,8 +1112,11 @@ void st_select_lex_unit::exclude_level()
SELECT_LEX_UNIT *units= 0, **units_last= &units; SELECT_LEX_UNIT *units= 0, **units_last= &units;
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
{ {
// unlink current level from global SELECTs list
if (sl->link_prev && (*sl->link_prev= sl->link_next)) if (sl->link_prev && (*sl->link_prev= sl->link_next))
sl->link_next->link_prev= sl->link_prev; sl->link_next->link_prev= sl->link_prev;
// bring up underlay levels
SELECT_LEX_UNIT **last= 0; SELECT_LEX_UNIT **last= 0;
for (SELECT_LEX_UNIT *u= sl->first_inner_unit(); u; u= u->next_unit()) for (SELECT_LEX_UNIT *u= sl->first_inner_unit(); u; u= u->next_unit())
{ {
...@@ -1128,11 +1131,20 @@ void st_select_lex_unit::exclude_level() ...@@ -1128,11 +1131,20 @@ void st_select_lex_unit::exclude_level()
} }
if (units) if (units)
{ {
// include brought up levels in place of current
(*prev)= units; (*prev)= units;
(*units_last)= (SELECT_LEX_UNIT*)next; (*units_last)= (SELECT_LEX_UNIT*)next;
if (next)
next->prev= (SELECT_LEX_NODE**)units_last;
units->prev= prev;
} }
else else
{
// exclude currect unit from list of nodes
(*prev)= next; (*prev)= next;
if (next)
next->prev= prev;
}
} }
...@@ -1147,15 +1159,20 @@ void st_select_lex_unit::exclude_tree() ...@@ -1147,15 +1159,20 @@ void st_select_lex_unit::exclude_tree()
SELECT_LEX_UNIT *units= 0, **units_last= &units; SELECT_LEX_UNIT *units= 0, **units_last= &units;
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
{ {
// unlink current level from global SELECTs list
if (sl->link_prev && (*sl->link_prev= sl->link_next)) if (sl->link_prev && (*sl->link_prev= sl->link_next))
sl->link_next->link_prev= sl->link_prev; sl->link_next->link_prev= sl->link_prev;
// unlink underlay levels
for (SELECT_LEX_UNIT *u= sl->first_inner_unit(); u; u= u->next_unit()) for (SELECT_LEX_UNIT *u= sl->first_inner_unit(); u; u= u->next_unit())
{ {
u->exclude_level(); u->exclude_level();
} }
} }
// exclude currect unit from list of nodes
(*prev)= next; (*prev)= next;
if (next)
next->prev= prev;
} }
......
...@@ -72,7 +72,7 @@ Long data handling: ...@@ -72,7 +72,7 @@ Long data handling:
#include "sql_select.h" // for JOIN #include "sql_select.h" // for JOIN
#include <m_ctype.h> // for isspace() #include <m_ctype.h> // for isspace()
#define IS_PARAM_NULL(pos, param_no) pos[param_no/8] & (1 << param_no & 7) #define IS_PARAM_NULL(pos, param_no) (pos[param_no/8] & (1 << (param_no & 7)))
#define STMT_QUERY_LOG_LENGTH 8192 #define STMT_QUERY_LOG_LENGTH 8192
......
...@@ -119,13 +119,18 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result, ...@@ -119,13 +119,18 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
SELECT_LEX *select_cursor,*sl; SELECT_LEX *select_cursor,*sl;
DBUG_ENTER("st_select_lex_unit::prepare"); DBUG_ENTER("st_select_lex_unit::prepare");
/*
result object should be reassigned even if preparing already done for
max/min subquery (ALL/ANY optimization)
*/
result= sel_result;
if (prepared) if (prepared)
DBUG_RETURN(0); DBUG_RETURN(0);
prepared= 1; prepared= 1;
res= 0; res= 0;
found_rows_for_union= first_select_in_union()->options & OPTION_FOUND_ROWS; found_rows_for_union= first_select_in_union()->options & OPTION_FOUND_ROWS;
TMP_TABLE_PARAM tmp_table_param; TMP_TABLE_PARAM tmp_table_param;
result= sel_result;
t_and_f= tables_and_fields_initied; t_and_f= tables_and_fields_initied;
bzero((char *)&tmp_table_param,sizeof(TMP_TABLE_PARAM)); bzero((char *)&tmp_table_param,sizeof(TMP_TABLE_PARAM));
......
This diff is collapsed.
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