mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 01:34:17 +01:00
Merge mysql.com:/home/kgeorge/mysql/5.0/tmp_merge
into mysql.com:/home/kgeorge/mysql/5.1/merge mysql-test/r/subselect.result: Auto merged mysql-test/r/view.result: Auto merged sql/item_subselect.cc: Auto merged
This commit is contained in:
commit
c4e26cb03d
5 changed files with 36 additions and 1 deletions
|
@ -3169,3 +3169,11 @@ create table t2 (a int, b int);
|
|||
insert into t2 values (2, 1), (1, 0);
|
||||
delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
|
||||
drop table t1, t2;
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
|
||||
ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
|
||||
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
|
||||
ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
|
||||
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
|
||||
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery'
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -706,7 +706,7 @@ create view v1 as select a from t1;
|
|||
create view v2 as select a from t2 where a in (select a from v1);
|
||||
show create view v2;
|
||||
View Create View
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `a` in (select `v1`.`a` AS `a` from `v1`)
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` in (select `v1`.`a` AS `a` from `v1`)
|
||||
drop view v2, v1;
|
||||
drop table t1, t2;
|
||||
CREATE VIEW `v 1` AS select 5 AS `5`;
|
||||
|
|
|
@ -2085,3 +2085,18 @@ create table t2 (a int, b int);
|
|||
insert into t2 values (2, 1), (1, 0);
|
||||
delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug #7549: Missing error message for invalid view selection with subquery
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
|
||||
--error 1054
|
||||
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
|
||||
--error 1054
|
||||
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
|
||||
--error 1054
|
||||
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -1354,6 +1354,17 @@ void Item_in_subselect::print(String *str)
|
|||
}
|
||||
|
||||
|
||||
bool Item_in_subselect::fix_fields(THD *thd, Item **ref)
|
||||
{
|
||||
bool result = 0;
|
||||
|
||||
if(thd->lex->view_prepare_mode && left_expr && !left_expr->fixed)
|
||||
result = left_expr->fix_fields(thd, &left_expr);
|
||||
|
||||
return result || Item_subselect::fix_fields(thd, ref);
|
||||
}
|
||||
|
||||
|
||||
Item_subselect::trans_res
|
||||
Item_allany_subselect::select_transformer(JOIN *join)
|
||||
{
|
||||
|
|
|
@ -258,6 +258,7 @@ public:
|
|||
void top_level_item() { abort_on_null=1; }
|
||||
bool test_limit(st_select_lex_unit *unit);
|
||||
void print(String *str);
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
|
||||
friend class Item_ref_null_helper;
|
||||
friend class Item_is_not_null_test;
|
||||
|
|
Loading…
Add table
Reference in a new issue