Mistakes corrected, test file corrected.
This commit is contained in:
parent
615da8f70b
commit
7ba19ba384
@ -1,9 +1,15 @@
|
|||||||
|
create table t1 (a int, b int);
|
||||||
|
|
||||||
|
insert into t1 values (1,2),(4,6),(9,7),(1,1),(2,5),(7,8);
|
||||||
|
|
||||||
values (1,2);
|
values (1,2);
|
||||||
|
|
||||||
select 1,2 union values (1,2);
|
select 1,2 union values (1,2);
|
||||||
|
|
||||||
values (1,2) union select (1,2);
|
values (1,2) union select (1,2);
|
||||||
|
|
||||||
|
values (1,2), (3,4) union select 1,2;
|
||||||
|
|
||||||
select * from t1 where (t1.a,t1.b) in (select 5,7 union values (1,2),(2,3));
|
select * from t1 where (t1.a,t1.b) in (select 5,7 union values (1,2),(2,3));
|
||||||
|
|
||||||
select * from t1 where (t1.a,t1.b) in (values (1,2),(2,3) union select 5,7);
|
select * from t1 where (t1.a,t1.b) in (values (1,2),(2,3) union select 5,7);
|
||||||
@ -26,5 +32,5 @@ create view v1 as select 1,2 union values (3,4),(5,6);
|
|||||||
|
|
||||||
eval $drop_view;
|
eval $drop_view;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
@ -2262,6 +2262,7 @@ void st_select_lex::init_select()
|
|||||||
with_dep= 0;
|
with_dep= 0;
|
||||||
join= 0;
|
join= 0;
|
||||||
lock_type= TL_READ_DEFAULT;
|
lock_type= TL_READ_DEFAULT;
|
||||||
|
tvc= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -19,6 +19,10 @@ public:
|
|||||||
List<List_item> lists_of_values;
|
List<List_item> lists_of_values;
|
||||||
select_result *result;
|
select_result *result;
|
||||||
|
|
||||||
|
table_value_constr(List<List_item> tvc_values) :
|
||||||
|
lists_of_values(tvc_values), result(0)
|
||||||
|
{ }
|
||||||
|
|
||||||
bool prepare(THD *thd_arg, SELECT_LEX *sl,
|
bool prepare(THD *thd_arg, SELECT_LEX *sl,
|
||||||
select_result *tmp_result);
|
select_result *tmp_result);
|
||||||
bool exec();
|
bool exec();
|
||||||
|
@ -1357,17 +1357,21 @@ bool st_select_lex_unit::exec()
|
|||||||
we don't calculate found_rows() per union part.
|
we don't calculate found_rows() per union part.
|
||||||
Otherwise, SQL_CALC_FOUND_ROWS should be done on all sub parts.
|
Otherwise, SQL_CALC_FOUND_ROWS should be done on all sub parts.
|
||||||
*/
|
*/
|
||||||
sl->join->select_options=
|
if (!sl->tvc)
|
||||||
(select_limit_cnt == HA_POS_ERROR || sl->braces) ?
|
{
|
||||||
sl->options & ~OPTION_FOUND_ROWS : sl->options | found_rows_for_union;
|
sl->join->select_options=
|
||||||
saved_error= sl->join->optimize();
|
(select_limit_cnt == HA_POS_ERROR || sl->braces) ?
|
||||||
|
sl->options & ~OPTION_FOUND_ROWS : sl->options | found_rows_for_union;
|
||||||
|
saved_error= sl->join->optimize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!saved_error)
|
if (!saved_error)
|
||||||
{
|
{
|
||||||
records_at_start= table->file->stats.records;
|
records_at_start= table->file->stats.records;
|
||||||
if (sl->tvc)
|
if (sl->tvc)
|
||||||
sl->tvc->exec();
|
sl->tvc->exec();
|
||||||
sl->join->exec();
|
else
|
||||||
|
sl->join->exec();
|
||||||
if (sl == union_distinct && !(with_element && with_element->is_recursive))
|
if (sl == union_distinct && !(with_element && with_element->is_recursive))
|
||||||
{
|
{
|
||||||
// This is UNION DISTINCT, so there should be a fake_select_lex
|
// This is UNION DISTINCT, so there should be a fake_select_lex
|
||||||
@ -1376,7 +1380,8 @@ bool st_select_lex_unit::exec()
|
|||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
table->no_keyread=1;
|
table->no_keyread=1;
|
||||||
}
|
}
|
||||||
saved_error= sl->join->error;
|
if (!sl->tvc)
|
||||||
|
saved_error= sl->join->error;
|
||||||
offset_limit_cnt= (ha_rows)(sl->offset_limit ?
|
offset_limit_cnt= (ha_rows)(sl->offset_limit ?
|
||||||
sl->offset_limit->val_uint() :
|
sl->offset_limit->val_uint() :
|
||||||
0);
|
0);
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
#include "lex_token.h"
|
#include "lex_token.h"
|
||||||
#include "sql_lex.h"
|
#include "sql_lex.h"
|
||||||
#include "sql_sequence.h"
|
#include "sql_sequence.h"
|
||||||
|
#include "sql_tvc.h"
|
||||||
|
|
||||||
/* this is to get the bison compilation windows warnings out */
|
/* this is to get the bison compilation windows warnings out */
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -16277,7 +16278,8 @@ table_value_constructor:
|
|||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
$$= Lex->current_select;
|
$$= Lex->current_select;
|
||||||
mysql_init_select(Lex);
|
mysql_init_select(Lex);
|
||||||
$$->tvc->lists_of_values= lex->many_values;
|
table_value_constr tvc(lex->many_values);
|
||||||
|
$$->tvc= &tvc;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user