Commit 91149bbd authored by Galina Shalygina's avatar Galina Shalygina

Mistakes corrected, new error messages added

parent 570d2e7d
......@@ -116,13 +116,13 @@ from (values (1),(5)) as tvc_1
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery4> ALL distinct_key NULL NULL NULL 2 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 Using where
4 MATERIALIZED <derived5> ALL NULL NULL NULL NULL 2 100.00
2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 100.00
5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) semi join ((values (1),(5)) `tvc_1`) where `test`.`t1`.`b` = `tvc_1`.`1`
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) semi join ((values (1),(5)) `tvc_1`) where `tvc_0`.`1` = `test`.`t1`.`a` and `test`.`t1`.`b` = `tvc_1`.`1`
# subquery with IN-predicate
select * from t1
where a in
......@@ -463,10 +463,10 @@ group by b
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 100.00
2 DERIVED t1 ALL NULL NULL NULL NULL 6 100.00 Using temporary; Using filesort
2 DERIVED <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
2 DERIVED <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 Using where
3 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00
4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 /* select#1 */ select `dr_table`.`max(a)` AS `max(a)`,`dr_table`.`b` AS `b` from (/* select#2 */ select max(`test`.`t1`.`a`) AS `max(a)`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(5)) `tvc_0`) where 1 group by `test`.`t1`.`b`) `dr_table`
Note 1003 /* select#1 */ select `dr_table`.`max(a)` AS `max(a)`,`dr_table`.`b` AS `b` from (/* select#2 */ select max(`test`.`t1`.`a`) AS `max(a)`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(5)) `tvc_0`) where `tvc_0`.`3` = `test`.`t1`.`b` group by `test`.`t1`.`b`) `dr_table`
drop table t1, t2;
set @@in_subquery_conversion_threshold= default;
create table t1 (a int, b int);
insert into t1 values (1,2),(4,6),(9,7),(1,1),(2,5),(7,8);
insert into t1 values (1,2),(4,6),(9,7),
(1,1),(2,5),(7,8);
# just VALUES
values (1,2);
1 2
......
......@@ -265,6 +265,13 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref)
if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&res))
return TRUE;
if (unit->first_select() &&
unit->first_select()->tvc)
{
my_error(ER_NO_TVC_IN_SUBQUERY, MYF(0));
res= 1;
goto end;
}
if (!(res= engine->prepare(thd)))
{
......
......@@ -7490,5 +7490,9 @@ ER_WRONG_INSERT_INTO_SEQUENCE
eng "Wrong INSERT into a SEQUENCE. One can only do single table INSERT into a squence object (like with mysqldump). If you want to change the SEQUENCE, use ALTER SEQUENCE instead."
ER_SP_STACK_TRACE
eng "At line %u in %s"
ER_WRONG_NUMBER_OF_COLUMNS_IN_TABLE_VALUE_CONSTRUCTOR
eng "The used TABLE VALUE CONSTRUCTOR has a different number of columns"
ER_WRONG_NUMBER_OF_VALUES_IN_TVC
eng "The used table value constructor has a different number of values"
ER_UNKNOWN_VALUE_IN_TVC
eng "Unknown value '%d' in table values constructor definition"
ER_NO_TVC_IN_SUBQUERY
eng "The usage of table value constructor as specification of subselect isn't implemented yet"
\ No newline at end of file
......@@ -646,6 +646,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
SELECT_LEX *first_select= unit->first_select();
if (first_select->tvc)
derived->is_for_tvc= true;
if (derived->is_recursive_with_table() &&
!derived->is_with_table_recursive_reference() &&
!derived->with->rec_result && derived->with->get_sq_rec_ref())
......
......@@ -347,8 +347,7 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
MYSQL_SELECT_START(thd->query());
if (select_lex->master_unit()->is_unit_op() ||
select_lex->master_unit()->fake_select_lex ||
select_lex->tvc)
select_lex->master_unit()->fake_select_lex)
res= mysql_union(thd, lex, result, &lex->unit, setup_tables_done_option);
else
{
......
......@@ -46,13 +46,20 @@ bool join_type_handlers_for_tvc(THD *thd_arg, List_iterator_fast<List_item> &li,
if (first_list_el_count != lst->elements)
{
my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_TABLE_VALUE_CONSTRUCTOR,
ER_THD(thd_arg, ER_WRONG_NUMBER_OF_COLUMNS_IN_TABLE_VALUE_CONSTRUCTOR),
my_message(ER_WRONG_NUMBER_OF_VALUES_IN_TVC,
ER_THD(thd_arg, ER_WRONG_NUMBER_OF_VALUES_IN_TVC),
MYF(0));
DBUG_RETURN(true);
}
for (uint pos= 0; (item=it++); pos++)
{
if (item->type() == Item::FIELD_ITEM)
{
my_error(ER_UNKNOWN_VALUE_IN_TVC, MYF(0),
((Item_field *)item)->full_name(),
MYF(0));
DBUG_RETURN(true);
}
const Type_handler *item_type_handler= item->real_type_handler();
if (first)
holders[pos].set_handler(item_type_handler);
......
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