mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
more resonable errors about name resolving in subqueries (BUG#1483)
This commit is contained in:
@ -1349,7 +1349,7 @@ create table t2 (s1 int);
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (1);
|
||||
update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
|
||||
ERROR 42S02: Unknown table 'x' in field list
|
||||
ERROR 42S22: Unknown column 'x.s1' in 'field list'
|
||||
DROP TABLE t1, t2;
|
||||
create table t1 (a int) type=innodb;
|
||||
create table t2 (a int) type=innodb;
|
||||
@ -1439,3 +1439,12 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
|
||||
drop table if exists t2, t3;
|
||||
create table t1 (s1 int);
|
||||
create table t2 (s1 int);
|
||||
select * from t1 where (select count(*) from t2 where t1.s2) = 1;
|
||||
ERROR 42S22: Unknown column 't1.s2' in 'where clause'
|
||||
select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
|
||||
ERROR 42S22: Unknown column 't1.s2' in 'group statement'
|
||||
select count(*) from t2 group by t1.s2;
|
||||
ERROR 42S02: Unknown table 't1' in group statement
|
||||
drop table t1, t2;
|
||||
|
@ -693,7 +693,7 @@ INSERT INTO t1 VALUES (1);
|
||||
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
|
||||
-- error 1111
|
||||
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
|
||||
-- error 1109
|
||||
-- error 1054
|
||||
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
|
||||
drop table t1;
|
||||
|
||||
@ -887,7 +887,7 @@ create table t1 (s1 int);
|
||||
create table t2 (s1 int);
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (1);
|
||||
-- error 1109
|
||||
-- error 1054
|
||||
update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
@ -965,3 +965,16 @@ insert into t2 values (2,2), (2,1), (3,3), (3,1);
|
||||
select * from t3 where a > all (select max(b) from t2 group by a);
|
||||
explain select * from t3 where a > all (select max(b) from t2 group by a);
|
||||
drop table if exists t2, t3;
|
||||
|
||||
#
|
||||
# unresolved field error
|
||||
#
|
||||
create table t1 (s1 int);
|
||||
create table t2 (s1 int);
|
||||
-- error 1054
|
||||
select * from t1 where (select count(*) from t2 where t1.s2) = 1;
|
||||
-- error 1054
|
||||
select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
|
||||
-- error 1109
|
||||
select count(*) from t2 group by t1.s2;
|
||||
drop table t1, t2;
|
Reference in New Issue
Block a user