Commit 75370a58 authored by Galina Shalygina's avatar Galina Shalygina

New tests on errors added. Comments corrected. Some procedures corrected.

parent 6bce8e14
......@@ -1630,4 +1630,22 @@ ANALYZE
}
}
}
# different number of values in TVC
values (1,2),(3,4,5);
ERROR HY000: The used table value constructor has a different number of values
# subquery that uses VALUES structure(s)
select * from t1
where a in (values (1));
ERROR HY000: Table value constructor can't be used as specification of subquery isn't implemented yet
select * from t1
where a in (select 2 union values (1));
ERROR HY000: Table value constructor can't be used as specification of subquery isn't implemented yet
select * from t1
where a in (values (1) union select 2);
ERROR HY000: Table value constructor can't be used as specification of subquery isn't implemented yet
# illegal parameter data types in TVC
values (1,point(1,1)),(1,1);
ERROR HY000: Illegal parameter data types geometry and int for operation 'TABLE VALUE CONSTRUCTOR'
values (1,point(1,1)+1);
ERROR HY000: Illegal parameter data types geometry and int for operation '+'
drop table t1;
......@@ -852,4 +852,25 @@ values (3,4)
union all
values (1,2);
--echo # different number of values in TVC
--error ER_WRONG_NUMBER_OF_VALUES_IN_TVC
values (1,2),(3,4,5);
--echo # subquery that uses VALUES structure(s)
--error ER_TVC_IN_SUBQUERY
select * from t1
where a in (values (1));
--error ER_TVC_IN_SUBQUERY
select * from t1
where a in (select 2 union values (1));
--error ER_TVC_IN_SUBQUERY
select * from t1
where a in (values (1) union select 2);
--echo # illegal parameter data types in TVC
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
values (1,point(1,1)),(1,1);
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
values (1,point(1,1)+1);
drop table t1;
\ No newline at end of file
......@@ -265,12 +265,14 @@ 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)
for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select())
{
my_error(ER_NO_TVC_IN_SUBQUERY, MYF(0));
res= 1;
goto end;
if (sl->tvc)
{
my_error(ER_TVC_IN_SUBQUERY, MYF(0));
res= 1;
goto end;
}
}
if (!(res= engine->prepare(thd)))
......
......@@ -7492,7 +7492,5 @@ ER_SP_STACK_TRACE
eng "At line %u in %s"
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
ER_TVC_IN_SUBQUERY
eng "Table value constructor can't be used as specification of subquery isn't implemented yet"
\ No newline at end of file
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