1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-34679 ER_BAD_FIELD uses non-localizable substrings

This commit is contained in:
Sergei Golubchik
2024-07-18 15:20:42 +02:00
parent 99178311ac
commit 3a1cf2c85b
349 changed files with 1218 additions and 1796 deletions

View File

@ -59,7 +59,7 @@ SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA',
Kundentyp kategorie Kundentyp kategorie
Privat (Private Nutzung) Mobilfunk Privat (Private Nutzung) Mobilfunk
Warnings: Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous Warning 1052 Column 'kundentyp' in GROUP BY is ambiguous
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
AUFNR varchar(12) NOT NULL default '', AUFNR varchar(12) NOT NULL default '',

View File

@ -712,7 +712,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
alter table table_24562 order by (select 12 from dual); alter table table_24562 order by (select 12 from dual);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(select 12 from dual)' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(select 12 from dual)' at line 1
alter table table_24562 order by no_such_col; alter table table_24562 order by no_such_col;
ERROR 42S22: Unknown column 'no_such_col' in 'order clause' ERROR 42S22: Unknown column 'no_such_col' in 'ORDER BY'
drop table table_24562; drop table table_24562;
create table t1 (mycol int(10) not null); create table t1 (mycol int(10) not null);
alter table t1 alter column mycol set default 0; alter table t1 alter column mycol set default 0;

View File

@ -228,7 +228,7 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
UPDATE t2 SET f = f + 10; UPDATE t2 SET f = f + 10;
ERROR 42S22: Unknown column 'd' in 'OLD' ERROR 42S22: Unknown column 'd' in 'OLD'
CALL sp1(); CALL sp1();
ERROR 42S22: Unknown column 'd' in 'field list' ERROR 42S22: Unknown column 'd' in 'INSERT INTO'
DROP TRIGGER trg1; DROP TRIGGER trg1;
DROP PROCEDURE sp1; DROP PROCEDURE sp1;
CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a))); CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a)));

View File

@ -204,17 +204,17 @@ drop table t0, t1;
create table t1 (i int); create table t1 (i int);
insert into t1 values (1),(2); insert into t1 values (1),(2);
analyze select a from t1; analyze select a from t1;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
analyze delete from t1 where a=2; analyze delete from t1 where a=2;
ERROR 42S22: Unknown column 'a' in 'where clause' ERROR 42S22: Unknown column 'a' in 'WHERE'
analyze update t1 set a=2; analyze update t1 set a=2;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SET'
create table t2 like t1; create table t2 like t1;
insert into t2 select * from t1; insert into t2 select * from t1;
analyze update t2,t1 set t2.i=5 where t2.a=t1.a; analyze update t2,t1 set t2.i=5 where t2.a=t1.a;
ERROR 42S22: Unknown column 't2.a' in 'where clause' ERROR 42S22: Unknown column 't2.a' in 'WHERE'
analyze delete t1 from t2,t1 where t2.a=t1.a; analyze delete t1 from t2,t1 where t2.a=t1.a;
ERROR 42S22: Unknown column 't2.a' in 'where clause' ERROR 42S22: Unknown column 't2.a' in 'WHERE'
drop table t1, t2; drop table t1, t2;
# #
# MDEV-6395: ANALYZE UPDATE/DELETE with impossible where does not produce any output # MDEV-6395: ANALYZE UPDATE/DELETE with impossible where does not produce any output

View File

@ -2162,7 +2162,7 @@ SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA',
Kundentyp kategorie Kundentyp kategorie
Privat (Private Nutzung) Mobilfunk Privat (Private Nutzung) Mobilfunk
Warnings: Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous Warning 1052 Column 'kundentyp' in GROUP BY is ambiguous
drop table t1; drop table t1;
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';
Variable_name Value Variable_name Value

View File

@ -750,7 +750,7 @@ ERROR HY000: No anchors for recursive WITH element 's'
#erroneous definition of unreferenced with table t #erroneous definition of unreferenced with table t
with t as (select count(*) from t1 where d>='f' group by a) with t as (select count(*) from t1 where d>='f' group by a)
select t1.b from t2,t1 where t1.a = t2.c; select t1.b from t2,t1 where t1.a = t2.c;
ERROR 42S22: Unknown column 'd' in 'where clause' ERROR 42S22: Unknown column 'd' in 'WHERE'
with t as (select count(*) from t1 where b>='f' group by a) with t as (select count(*) from t1 where b>='f' group by a)
select t1.b from t2,t1 where t1.a = t2.c; select t1.b from t2,t1 where t1.a = t2.c;
b b
@ -762,11 +762,11 @@ ggg
with t(d) as (select count(*) from t1 where b<='ccc' group by b), with t(d) as (select count(*) from t1 where b<='ccc' group by b),
s as (select * from t1 where a in (select t2.d from t2,t where t2.c=t.d)) s as (select * from t1 where a in (select t2.d from t2,t where t2.c=t.d))
select t1.b from t1,t2 where t1.a=t2.c; select t1.b from t1,t2 where t1.a=t2.c;
ERROR 42S22: Unknown column 't2.d' in 'field list' ERROR 42S22: Unknown column 't2.d' in 'SELECT'
with t(d) as (select count(*) from t1 where b<='ccc' group by b), with t(d) as (select count(*) from t1 where b<='ccc' group by b),
s as (select * from t1 where a in (select t2.c from t2,t where t2.c=t.c)) s as (select * from t1 where a in (select t2.c from t2,t where t2.c=t.c))
select t1.b from t1,t2 where t1.a=t2.c; select t1.b from t1,t2 where t1.a=t2.c;
ERROR 42S22: Unknown column 't.c' in 'where clause' ERROR 42S22: Unknown column 't.c' in 'WHERE'
with t(d) as (select count(*) from t1 where b<='ccc' group by b), with t(d) as (select count(*) from t1 where b<='ccc' group by b),
s as (select * from t1 where a in (select t2.c from t2,t where t2.c=t.d)) s as (select * from t1 where a in (select t2.c from t2,t where t2.c=t.d))
select t1.b from t1,t2 where t1.a=t2.c; select t1.b from t1,t2 where t1.a=t2.c;
@ -1889,13 +1889,13 @@ cte1(a) as (select * from t1 where c1 <= 2),
cte2(b) as (select * from cte1 where c1 >= 2), cte2(b) as (select * from cte1 where c1 >= 2),
cte3 as (select * from cte1,cte2 where cte1.a < cte2.b) cte3 as (select * from cte1,cte2 where cte1.a < cte2.b)
select * from t2; select * from t2;
ERROR 42S22: Unknown column 'c1' in 'where clause' ERROR 42S22: Unknown column 'c1' in 'WHERE'
with with
cte1(a) as (select * from t1 where c1 <= 2), cte1(a) as (select * from t1 where c1 <= 2),
cte2(b) as (select * from cte1 where a >= 2), cte2(b) as (select * from cte1 where a >= 2),
cte3 as (select * from cte1,cte2 where cte1.a < cte2.c1) cte3 as (select * from cte1,cte2 where cte1.a < cte2.c1)
select * from t2; select * from t2;
ERROR 42S22: Unknown column 'cte2.c1' in 'where clause' ERROR 42S22: Unknown column 'cte2.c1' in 'WHERE'
with with
cte1 as (select * from t1 where c1 <= 2), cte1 as (select * from t1 where c1 <= 2),
cte2(a,b) as (select * from cte1 as s1, cte1 as s2 where s1.c1=s2.c1) cte2(a,b) as (select * from cte1 as s1, cte1 as s2 where s1.c1=s2.c1)
@ -1914,7 +1914,7 @@ with
cte1 as (select * from t1 where c1 <= 2), cte1 as (select * from t1 where c1 <= 2),
cte2(a,b) as (select * from cte1 as s1, cte1 as s2 where s1.c1=c1) cte2(a,b) as (select * from cte1 as s1, cte1 as s2 where s1.c1=c1)
select * from t2; select * from t2;
ERROR 23000: Column 'c1' in where clause is ambiguous ERROR 23000: Column 'c1' in WHERE is ambiguous
with cte3 as with cte3 as
( with cte2(a,b) as ( with cte2(a,b) as
( with cte1 as (select * from t1 where c1 <= 2) ( with cte1 as (select * from t1 where c1 <= 2)
@ -1941,7 +1941,7 @@ with cte3 as
select * from cte1 as s1, cte1 as s2 where s1.c1=s2.c1) select * from cte1 as s1, cte1 as s2 where s1.c1=s2.c1)
select r1.c1,r2.c1 from cte2 as r1, cte2 as r2) select r1.c1,r2.c1 from cte2 as r1, cte2 as r2)
select * from t2; select * from t2;
ERROR 42S22: Unknown column 'r1.c1' in 'field list' ERROR 42S22: Unknown column 'r1.c1' in 'SELECT'
create procedure p1() create procedure p1()
begin begin
insert into t2 insert into t2
@ -1962,7 +1962,7 @@ with cte1 as (select a from t1)
select * from t1 as s, t1 as t where s.c1=t.c1 and s.c1 <= 2 and t.c1 >= 2; select * from t1 as s, t1 as t where s.c1=t.c1 and s.c1 <= 2 and t.c1 >= 2;
end | end |
call p1(); call p1();
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
drop procedure p1; drop procedure p1;
drop table t1,t2; drop table t1,t2;
# #

View File

@ -4543,33 +4543,33 @@ insert into t1 values (3), (7), (1);
with recursive with recursive
r as (select * from t1 union select s1.* from t1 as s1, r where s1.a = r.b) r as (select * from t1 union select s1.* from t1 as s1, r where s1.a = r.b)
select * from t1 as t; select * from t1 as t;
ERROR 42S22: Unknown column 'r.b' in 'where clause' ERROR 42S22: Unknown column 'r.b' in 'WHERE'
explain with recursive explain with recursive
r as (select * from t1 union select s1.* from t1 as s1, r where s1.a = r.b) r as (select * from t1 union select s1.* from t1 as s1, r where s1.a = r.b)
select * from t1 as t; select * from t1 as t;
ERROR 42S22: Unknown column 'r.b' in 'where clause' ERROR 42S22: Unknown column 'r.b' in 'WHERE'
create procedure sp1() with recursive create procedure sp1() with recursive
r as (select * from t1 union select s1.* from t1 as s1, r where s1.a = r.b) r as (select * from t1 union select s1.* from t1 as s1, r where s1.a = r.b)
select * from t1 as t; select * from t1 as t;
call sp1(); call sp1();
ERROR 42S22: Unknown column 'r.b' in 'where clause' ERROR 42S22: Unknown column 'r.b' in 'WHERE'
call sp1(); call sp1();
ERROR 42S22: Unknown column 'r.b' in 'where clause' ERROR 42S22: Unknown column 'r.b' in 'WHERE'
with recursive with recursive
r as (select * from t1 union select s1.* from t1 as s1, r where s1.b = r.a) r as (select * from t1 union select s1.* from t1 as s1, r where s1.b = r.a)
select * from t1 as t; select * from t1 as t;
ERROR 42S22: Unknown column 's1.b' in 'where clause' ERROR 42S22: Unknown column 's1.b' in 'WHERE'
explain with recursive explain with recursive
r as (select * from t1 union select s1.* from t1 as s1, r where s1.b = r.a) r as (select * from t1 union select s1.* from t1 as s1, r where s1.b = r.a)
select * from t1 as t; select * from t1 as t;
ERROR 42S22: Unknown column 's1.b' in 'where clause' ERROR 42S22: Unknown column 's1.b' in 'WHERE'
create procedure sp2() with recursive create procedure sp2() with recursive
r as (select * from t1 union select s1.* from t1 as s1, r where s1.b = r.a) r as (select * from t1 union select s1.* from t1 as s1, r where s1.b = r.a)
select * from t1 as t; select * from t1 as t;
call sp2(); call sp2();
ERROR 42S22: Unknown column 's1.b' in 'where clause' ERROR 42S22: Unknown column 's1.b' in 'WHERE'
call sp2(); call sp2();
ERROR 42S22: Unknown column 's1.b' in 'where clause' ERROR 42S22: Unknown column 's1.b' in 'WHERE'
drop procedure sp1; drop procedure sp1;
drop procedure sp2; drop procedure sp2;
drop table t1; drop table t1;

View File

@ -253,7 +253,7 @@ CREATE TABLE t1 (a INT);
INSERT DELAYED INTO t1 SET a= b(); INSERT DELAYED INTO t1 SET a= b();
ERROR 42000: FUNCTION test.b does not exist ERROR 42000: FUNCTION test.b does not exist
INSERT DELAYED INTO t1 SET b= 1; INSERT DELAYED INTO t1 SET b= 1;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'INSERT INTO'
INSERT DELAYED INTO t1 SET b= b(); INSERT DELAYED INTO t1 SET b= b();
ERROR 42000: FUNCTION test.b does not exist ERROR 42000: FUNCTION test.b does not exist
DROP TABLE t1; DROP TABLE t1;

View File

@ -53,7 +53,7 @@ CREATE TABLE `t1` (
PRIMARY KEY (`i`) PRIMARY KEY (`i`)
); );
DELETE FROM t1 USING t1 WHERE post='1'; DELETE FROM t1 USING t1 WHERE post='1';
ERROR 42S22: Unknown column 'post' in 'where clause' ERROR 42S22: Unknown column 'post' in 'WHERE'
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
bool char(0) default NULL, bool char(0) default NULL,
@ -229,11 +229,11 @@ drop table t1;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
DELETE FROM t1 ORDER BY x; DELETE FROM t1 ORDER BY x;
ERROR 42S22: Unknown column 'x' in 'order clause' ERROR 42S22: Unknown column 'x' in 'ORDER BY'
DELETE FROM t1 ORDER BY t2.x; DELETE FROM t1 ORDER BY t2.x;
ERROR 42S22: Unknown column 't2.x' in 'order clause' ERROR 42S22: Unknown column 't2.x' in 'ORDER BY'
DELETE FROM t1 ORDER BY (SELECT x); DELETE FROM t1 ORDER BY (SELECT x);
ERROR 42S22: Unknown column 'x' in 'field list' ERROR 42S22: Unknown column 'x' in 'SELECT'
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a INT a INT

View File

@ -42,7 +42,7 @@ a b
5 EEEEE 5 EEEEE
7 GGGGGGG 7 GGGGGGG
DELETE FROM t1 WHERE a=2 RETURNING c; DELETE FROM t1 WHERE a=2 RETURNING c;
ERROR 42S22: Unknown column 'c' in 'field list' ERROR 42S22: Unknown column 'c' in 'RETURNING'
INSERT INTO t1 VALUES (2,'BB'), (2,'bb'); INSERT INTO t1 VALUES (2,'BB'), (2,'bb');
DELETE FROM t1 WHERE a=2 RETURNING a, UPPER(b); DELETE FROM t1 WHERE a=2 RETURNING a, UPPER(b);
a UPPER(b) a UPPER(b)

View File

@ -5,9 +5,9 @@ select * from (select 2 from DUAL) b;
2 2
2 2
SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; SELECT 1 as a FROM (SELECT a UNION SELECT 1) b;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
CREATE TABLE t1 (a int not null, b char (10) not null); CREATE TABLE t1 (a int not null, b char (10) not null);
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
CREATE TABLE t2 (a int not null, b char (10) not null); CREATE TABLE t2 (a int not null, b char (10) not null);
@ -27,18 +27,18 @@ a y
3 3 3 3
3 3 3 3
SELECT a FROM (SELECT 1 FROM (SELECT 1) a HAVING a=1) b; SELECT a FROM (SELECT 1 FROM (SELECT 1) a HAVING a=1) b;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT a,b as a FROM (SELECT '1' as a,'2' as b) b HAVING a=1; SELECT a,b as a FROM (SELECT '1' as a,'2' as b) b HAVING a=1;
ERROR 23000: Column 'a' in having clause is ambiguous ERROR 23000: Column 'a' in HAVING is ambiguous
SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=2; SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=2;
a a a a
1 2 1 2
SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=1; SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=1;
a a a a
SELECT 1 FROM (SELECT 1) a WHERE a=2; SELECT 1 FROM (SELECT 1) a WHERE a=2;
ERROR 42S22: Unknown column 'a' in 'where clause' ERROR 42S22: Unknown column 'a' in 'WHERE'
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) as a; SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) as a;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
select * from t1 as x1, (select * from t1) as x2; select * from t1 as x1, (select * from t1) as x2;
a b a b a b a b
1 a 1 a 1 a 1 a
@ -154,13 +154,13 @@ select * from (select 1 as a) b left join (select 2 as a) c using(a);
a a
1 1
SELECT * FROM (SELECT 1 UNION SELECT a) b; SELECT * FROM (SELECT 1 UNION SELECT a) b;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; SELECT 1 as a FROM (SELECT a UNION SELECT 1) b;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
select 1 from (select 2) a order by 0; select 1 from (select 2) a order by 0;
ERROR 42S22: Unknown column '0' in 'order clause' ERROR 42S22: Unknown column '0' in 'ORDER BY'
create table t1 (id int); create table t1 (id int);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
describe select * from (select * from t1 group by id) bar; describe select * from (select * from t1 group by id) bar;
@ -276,7 +276,7 @@ N M
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2; UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2;
ERROR HY000: The target table P2 of the UPDATE is not updatable ERROR HY000: The target table P2 of the UPDATE is not updatable
UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2; UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
ERROR 42S22: Unknown column 'aaaa' in 'field list' ERROR 42S22: Unknown column 'aaaa' in 'SELECT'
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N; delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
select * from t1; select * from t1;
N M N M
@ -284,7 +284,7 @@ N M
delete P1.*,p2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS p2 ON P1.N = p2.N; delete P1.*,p2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS p2 ON P1.N = p2.N;
ERROR HY000: The target table p2 of the DELETE is not updatable ERROR HY000: The target table p2 of the DELETE is not updatable
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N; delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
ERROR 42S22: Unknown column 'aaa' in 'field list' ERROR 42S22: Unknown column 'aaa' in 'SELECT'
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
OBJECTID int(11) NOT NULL default '0', OBJECTID int(11) NOT NULL default '0',
@ -467,7 +467,7 @@ t1.id=t3.val
set set
t1.val=t3.val t1.val=t3.val
; ;
ERROR 42S22: Unknown column 'v.val' in 'field list' ERROR 42S22: Unknown column 'v.val' in 'SELECT'
drop table t1, t2; drop table t1, t2;
# #
# MDEV-5353: server crash on subselect if WHERE applied to some # MDEV-5353: server crash on subselect if WHERE applied to some
@ -1336,7 +1336,7 @@ DROP TABLE t1;
SELECT 1 FROM ( SELECT 1 FROM (
SELECT 1 UNION SELECT 2 ORDER BY (SELECT 1 FROM DUAL WHERE xxx = 0) SELECT 1 UNION SELECT 2 ORDER BY (SELECT 1 FROM DUAL WHERE xxx = 0)
) dt; ) dt;
ERROR 42S22: Unknown column 'xxx' in 'where clause' ERROR 42S22: Unknown column 'xxx' in 'WHERE'
create table t1 (a int, b int); create table t1 (a int, b int);
insert into t1 values (3,8), (7,2), (1,4), (5,9); insert into t1 values (3,8), (7,2), (1,4), (5,9);
create table t2 (a int, b int); create table t2 (a int, b int);
@ -1350,7 +1350,7 @@ union
select a,b from t2 where t2.b < 6 select a,b from t2 where t2.b < 6
order by (a - b / (select a + max(c) from t3 where d = x)) order by (a - b / (select a + max(c) from t3 where d = x))
) dt; ) dt;
ERROR 42S22: Unknown column 'x' in 'where clause' ERROR 42S22: Unknown column 'x' in 'WHERE'
drop table t1,t2,t3; drop table t1,t2,t3;
# #
# End of 10.3 tests # End of 10.3 tests

View File

@ -1621,7 +1621,7 @@ ex
# as a dynamic column name # as a dynamic column name
# #
select COLUMN_CREATE(color, "black"); select COLUMN_CREATE(color, "black");
ERROR 42S22: Unknown column 'color' in 'field list' ERROR 42S22: Unknown column 'color' in 'SELECT'
# #
# MDEV-489 Assertion `offset < 0x1f' failed in # MDEV-489 Assertion `offset < 0x1f' failed in
# type_and_offset_store on COLUMN_ADD # type_and_offset_store on COLUMN_ADD

View File

@ -7,21 +7,21 @@ update t1 set a=1;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
create table t1 (a int); create table t1 (a int);
select count(test.t1.b) from t1; select count(test.t1.b) from t1;
ERROR 42S22: Unknown column 'test.t1.b' in 'field list' ERROR 42S22: Unknown column 'test.t1.b' in 'SELECT'
select count(not_existing_database.t1) from t1; select count(not_existing_database.t1) from t1;
ERROR 42S22: Unknown column 'not_existing_database.t1' in 'field list' ERROR 42S22: Unknown column 'not_existing_database.t1' in 'SELECT'
select count(not_existing_database.t1.a) from t1; select count(not_existing_database.t1.a) from t1;
ERROR 42S22: Unknown column 'not_existing_database.t1.a' in 'field list' ERROR 42S22: Unknown column 'not_existing_database.t1.a' in 'SELECT'
select count(not_existing_database.t1.a) from not_existing_database.t1; select count(not_existing_database.t1.a) from not_existing_database.t1;
Got one of the listed errors Got one of the listed errors
select 1 from t1 order by 2; select 1 from t1 order by 2;
ERROR 42S22: Unknown column '2' in 'order clause' ERROR 42S22: Unknown column '2' in 'ORDER BY'
select 1 from t1 group by 2; select 1 from t1 group by 2;
ERROR 42S22: Unknown column '2' in 'group statement' ERROR 42S22: Unknown column '2' in 'GROUP BY'
select 1 from t1 order by t1.b; select 1 from t1 order by t1.b;
ERROR 42S22: Unknown column 't1.b' in 'order clause' ERROR 42S22: Unknown column 't1.b' in 'ORDER BY'
select count(*),b from t1; select count(*),b from t1;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
drop table t1; drop table t1;
create table t1 (a int(256)); create table t1 (a int(256));
ERROR 42000: Display width out of range for 'a' (max = 255) ERROR 42000: Display width out of range for 'a' (max = 255)
@ -45,17 +45,17 @@ Warning 1365 Division by 0
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1( a INT ); CREATE TABLE t1( a INT );
SELECT b FROM t1; SELECT b FROM t1;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
SHOW ERRORS; SHOW ERRORS;
Level Code Message Level Code Message
Error 1054 Unknown column 'b' in 'field list' Error 1054 Unknown column 'b' in 'SELECT'
CREATE TABLE t2 SELECT b FROM t1; CREATE TABLE t2 SELECT b FROM t1;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
SHOW ERRORS; SHOW ERRORS;
Level Code Message Level Code Message
Error 1054 Unknown column 'b' in 'field list' Error 1054 Unknown column 'b' in 'SELECT'
INSERT INTO t1 SELECT b FROM t1; INSERT INTO t1 SELECT b FROM t1;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
DROP TABLE t1; DROP TABLE t1;
flush status; flush status;
drop table if exists t1, t2; drop table if exists t1, t2;

View File

@ -205,7 +205,7 @@ INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
EXPLAIN SELECT DISTINCT 1 FROM t1, EXPLAIN SELECT DISTINCT 1 FROM t1,
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1 (SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1
WHERE t1.a = d1.a; WHERE t1.a = d1.a;
ERROR 42S22: Unknown column 'd1.a' in 'where clause' ERROR 42S22: Unknown column 'd1.a' in 'WHERE'
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#48295: # Bug#48295:

View File

@ -126,7 +126,7 @@ group by
a.text, b.id, b.betreff a.text, b.id, b.betreff
order by order by
match(b.betreff) against ('+abc' in boolean mode) desc; match(b.betreff) against ('+abc' in boolean mode) desc;
ERROR 42000: Table 'b' from one of the SELECTs cannot be used in order clause ERROR 42000: Table 'b' from one of the SELECTs cannot be used in ORDER BY
select a.text, b.id, b.betreff select a.text, b.id, b.betreff
from from
t2 a inner join t3 b on a.id = b.forum inner join t2 a inner join t3 b on a.id = b.forum inner join
@ -142,7 +142,7 @@ where
match(c.beitrag) against ('+abc' in boolean mode) match(c.beitrag) against ('+abc' in boolean mode)
order by order by
match(b.betreff) against ('+abc' in boolean mode) desc; match(b.betreff) against ('+abc' in boolean mode) desc;
ERROR 42000: Table 'b' from one of the SELECTs cannot be used in order clause ERROR 42000: Table 'b' from one of the SELECTs cannot be used in ORDER BY
select a.text, b.id, b.betreff select a.text, b.id, b.betreff
from from
t2 a inner join t3 b on a.id = b.forum inner join t2 a inner join t3 b on a.id = b.forum inner join

View File

@ -160,7 +160,7 @@ set group_concat_max_len = 1024;
select group_concat(sum(c)) from t1 group by grp; select group_concat(sum(c)) from t1 group by grp;
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
select grp,group_concat(c order by 2) from t1 group by grp; select grp,group_concat(c order by 2) from t1 group by grp;
ERROR 42S22: Unknown column '2' in 'order clause' ERROR 42S22: Unknown column '2' in 'ORDER BY'
drop table t1; drop table t1;
create table t1 ( URL_ID int(11), URL varchar(80)); create table t1 ( URL_ID int(11), URL varchar(80));
create table t2 ( REQ_ID int(11), URL_ID int(11)); create table t2 ( REQ_ID int(11), URL_ID int(11));

View File

@ -154,7 +154,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings: Warnings:
Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)` Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
select rand(rand); select rand(rand);
ERROR 42S22: Unknown column 'rand' in 'field list' ERROR 42S22: Unknown column 'rand' in 'SELECT'
create table t1 (col1 int, col2 decimal(60,30)); create table t1 (col1 int, col2 decimal(60,30));
insert into t1 values(1,1234567890.12345); insert into t1 values(1,1234567890.12345);
select format(col2,7) from t1; select format(col2,7) from t1;

View File

@ -134,7 +134,7 @@ DROP PROCEDURE p1;
GET DIAGNOSTICS CONDITION; GET DIAGNOSTICS CONDITION;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
GET DIAGNOSTICS CONDITION a; GET DIAGNOSTICS CONDITION a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'GET DIAGNOSTICS'
GET DIAGNOSTICS CONDITION 1; GET DIAGNOSTICS CONDITION 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
GET DIAGNOSTICS CONDITION 1 @var; GET DIAGNOSTICS CONDITION 1 @var;
@ -213,9 +213,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
GET DIAGNOSTICS CONDITION (1) @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION (1) @var = CLASS_ORIGIN;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(1) @var = CLASS_ORIGIN' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(1) @var = CLASS_ORIGIN' at line 1
GET DIAGNOSTICS CONDITION p1() @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION p1() @var = CLASS_ORIGIN;
ERROR 42S22: Unknown column 'p1' in 'field list' ERROR 42S22: Unknown column 'p1' in 'GET DIAGNOSTICS'
GET DIAGNOSTICS CONDITION ABS(2) @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION ABS(2) @var = CLASS_ORIGIN;
ERROR 42S22: Unknown column 'ABS' in 'field list' ERROR 42S22: Unknown column 'ABS' in 'GET DIAGNOSTICS'
GET DIAGNOSTICS CONDITION 1.1 @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION 1.1 @var = CLASS_ORIGIN;
GET DIAGNOSTICS CONDITION "1" @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION "1" @var = CLASS_ORIGIN;
SELECT COUNT(max_questions) INTO @var FROM mysql.user; SELECT COUNT(max_questions) INTO @var FROM mysql.user;
@ -227,7 +227,7 @@ Warnings:
Error 1758 Invalid condition number Error 1758 Invalid condition number
Error 1758 Invalid condition number Error 1758 Invalid condition number
GET DIAGNOSTICS CONDITION a @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION a @var = CLASS_ORIGIN;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'GET DIAGNOSTICS'
SELECT COUNT(max_questions) INTO @var FROM mysql.user; SELECT COUNT(max_questions) INTO @var FROM mysql.user;
SET @cond = 1; SET @cond = 1;
GET DIAGNOSTICS CONDITION @cond @var1 = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION @cond @var1 = CLASS_ORIGIN;

View File

@ -790,7 +790,7 @@ SELECT n+1 AS n FROM t1 GROUP BY n;
n n
2 2
Warnings: Warnings:
Warning 1052 Column 'n' in group statement is ambiguous Warning 1052 Column 'n' in GROUP BY is ambiguous
DROP TABLE t1; DROP TABLE t1;
create table t1(f1 varchar(5) key); create table t1(f1 varchar(5) key);
insert into t1 values (1),(2); insert into t1 values (1),(2);
@ -877,10 +877,10 @@ c2
aaa aaa
aaa aaa
Warnings: Warnings:
Warning 1052 Column 'c2' in group statement is ambiguous Warning 1052 Column 'c2' in GROUP BY is ambiguous
show warnings; show warnings;
Level Code Message Level Code Message
Warning 1052 Column 'c2' in group statement is ambiguous Warning 1052 Column 'c2' in GROUP BY is ambiguous
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4 select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by t1.c1; group by t1.c1;
c2 c2
@ -1028,7 +1028,7 @@ FROM t1 AS t1_outer GROUP BY t1_outer.b;
ERROR 42000: 'test.t1_outer.a' isn't in GROUP BY ERROR 42000: 'test.t1_outer.a' isn't in GROUP BY
SELECT 1 FROM t1 as t1_outer GROUP BY a SELECT 1 FROM t1 as t1_outer GROUP BY a
HAVING (SELECT t1_outer.b FROM t1 AS t1_inner LIMIT 1); HAVING (SELECT t1_outer.b FROM t1 AS t1_inner LIMIT 1);
ERROR 42S22: Unknown column 'test.t1_outer.b' in 'field list' ERROR 42S22: Unknown column 'test.t1_outer.b' in 'SELECT'
SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner LIMIT 1) SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner LIMIT 1)
FROM t1 AS t1_outer GROUP BY t1_outer.b; FROM t1 AS t1_outer GROUP BY t1_outer.b;
(SELECT SUM(t1_inner.a) FROM t1 AS t1_inner LIMIT 1) (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner LIMIT 1)
@ -1070,7 +1070,7 @@ SELECT 1 FROM t1 GROUP BY b HAVING ROW (b,b) = ROW (1,1);
1 1
1 1
SELECT 1 FROM t1 GROUP BY b HAVING a = 2; SELECT 1 FROM t1 GROUP BY b HAVING a = 2;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT 1 FROM t1 GROUP BY SUM(b); SELECT 1 FROM t1 GROUP BY SUM(b);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
SELECT b FROM t1 AS t1_outer GROUP BY a HAVING t1_outer.a IN SELECT b FROM t1 AS t1_outer GROUP BY a HAVING t1_outer.a IN
@ -2559,7 +2559,7 @@ DROP TABLE t1,t2;
# MDEV-5104 crash in Item_field::used_tables with broken order by # MDEV-5104 crash in Item_field::used_tables with broken order by
# #
(select 1 order by x(y)) order by 1; (select 1 order by x(y)) order by 1;
ERROR 42S22: Unknown column 'y' in 'order clause' ERROR 42S22: Unknown column 'y' in 'ORDER BY'
# End of 5.3 tests # End of 5.3 tests
# #
# Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00 # Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00

View File

@ -200,7 +200,7 @@ select count(*) from t1 group by col2 having col2 = 'hello';
count(*) count(*)
3 3
select count(*) from t1 group by col2 having col1 = 10; select count(*) from t1 group by col2 having col1 = 10;
ERROR 42S22: Unknown column 'col1' in 'having clause' ERROR 42S22: Unknown column 'col1' in 'HAVING'
select col1 as count_col1 from t1 as tmp1 group by col1 having col1 = 10; select col1 as count_col1 from t1 as tmp1 group by col1 having col1 = 10;
count_col1 count_col1
10 10
@ -241,7 +241,7 @@ select sum(col1) as co2, count(col2) as cc from t1 group by col1 having col1 =10
co2 cc co2 cc
40 4 40 4
select t2.col2 from t2 group by t2.col1, t2.col2 having t1.col1 <= 10; select t2.col2 from t2 group by t2.col1, t2.col2 having t1.col1 <= 10;
ERROR 42S22: Unknown column 't1.col1' in 'having clause' ERROR 42S22: Unknown column 't1.col1' in 'HAVING'
select t1.col1 from t1 select t1.col1 from t1
where t1.col2 in where t1.col2 in
(select t2.col2 from t2 (select t2.col2 from t2
@ -279,7 +279,7 @@ select t1.col1 as tmp_col from t1
where t1.col2 in where t1.col2 in
(select t2.col2 from t2 (select t2.col2 from t2
group by t2.col1, t2.col2 having tmp_col <= 10); group by t2.col1, t2.col2 having tmp_col <= 10);
ERROR 42S22: Unknown column 'tmp_col' in 'having clause' ERROR 42S22: Unknown column 'tmp_col' in 'HAVING'
select t1.col1 from t1 select t1.col1 from t1
where t1.col2 in where t1.col2 in
(select t2.col2 from t2 (select t2.col2 from t2
@ -301,7 +301,7 @@ where t1.col2 in
(select t2.col2 from t2 (select t2.col2 from t2
group by t2.col1, t2.col2 having col_t1 <= 10) group by t2.col1, t2.col2 having col_t1 <= 10)
having col_t1 <= 20; having col_t1 <= 20;
ERROR 42S22: Unknown column 'col_t1' in 'having clause' ERROR 42S22: Unknown column 'col_t1' in 'HAVING'
select t1.col1 from t1 select t1.col1 from t1
where t1.col2 in where t1.col2 in
(select t2.col2 from t2 (select t2.col2 from t2
@ -322,7 +322,7 @@ select sum(col1) from t1
group by col_t1 group by col_t1
having col_t1 in (select sum(t2.col1) from t2 having col_t1 in (select sum(t2.col1) from t2
group by t2.col2, t2.col1 having t2.col1 = t1.col1); group by t2.col2, t2.col1 having t2.col1 = t1.col1);
ERROR 42S22: Unknown column 't1.col1' in 'having clause' ERROR 42S22: Unknown column 't1.col1' in 'HAVING'
select sum(col1) from t1 select sum(col1) from t1
group by col_t1 group by col_t1
having col_t1 in (select sum(t2.col1) from t2 having col_t1 in (select sum(t2.col1) from t2
@ -333,10 +333,10 @@ sum(col1)
30 30
select t1.col1, t2.col1 from t1, t2 where t1.col1 = t2.col1 select t1.col1, t2.col1 from t1, t2 where t1.col1 = t2.col1
group by t1.col1, t2.col1 having col1 = 2; group by t1.col1, t2.col1 having col1 = 2;
ERROR 23000: Column 'col1' in having clause is ambiguous ERROR 23000: Column 'col1' in HAVING is ambiguous
select t1.col1*10+t2.col1 from t1,t2 where t1.col1=t2.col1 select t1.col1*10+t2.col1 from t1,t2 where t1.col1=t2.col1
group by t1.col1, t2.col1 having col1 = 2; group by t1.col1, t2.col1 having col1 = 2;
ERROR 23000: Column 'col1' in having clause is ambiguous ERROR 23000: Column 'col1' in HAVING is ambiguous
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (s1 int); create table t1 (s1 int);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
@ -348,8 +348,8 @@ s1
0 0
0 0
Warnings: Warnings:
Warning 1052 Column 's1' in group statement is ambiguous Warning 1052 Column 's1' in GROUP BY is ambiguous
Warning 1052 Column 's1' in having clause is ambiguous Warning 1052 Column 's1' in HAVING is ambiguous
select s1*0 from t1 group by s1 having s1 = 0; select s1*0 from t1 group by s1 having s1 = 0;
s1*0 s1*0
select s1 from t1 group by 1 having 1 = 0; select s1 from t1 group by 1 having 1 = 0;
@ -362,7 +362,7 @@ count(s1)
1 1
1 1
select * from t1 a, t1 b group by a.s1 having s1 is null; select * from t1 a, t1 b group by a.s1 having s1 is null;
ERROR 23000: Column 's1' in having clause is ambiguous ERROR 23000: Column 's1' in HAVING is ambiguous
drop table t1; drop table t1;
create table t1 (s1 char character set latin1 collate latin1_german1_ci); create table t1 (s1 char character set latin1 collate latin1_german1_ci);
insert ignore into t1 values ('ü'),('y'); insert ignore into t1 values ('ü'),('y');

View File

@ -68,6 +68,6 @@ COUNT(@@GLOBAL.Host_Cache_Size)
1 1
1 Expected 1 Expected
SELECT Host_Cache_Size = @@SESSION.Host_Cache_Size; SELECT Host_Cache_Size = @@SESSION.Host_Cache_Size;
ERROR 42S22: Unknown column 'Host_Cache_Size' in 'field list' ERROR 42S22: Unknown column 'Host_Cache_Size' in 'SELECT'
Expected error 'Unknown column Host_Cache_Size in field list' Expected error 'Unknown column Host_Cache_Size in field list'
SET @@GLOBAL.Host_Cache_Size=DEFAULT; SET @@GLOBAL.Host_Cache_Size=DEFAULT;

View File

@ -766,14 +766,14 @@ create table t3 (c int);
create table t4 (d1 int, d2 int); create table t4 (d1 int, d2 int);
insert into t4 insert into t4
select * from t1 left join t2 on (select t1.i from t3); select * from t1 left join t2 on (select t1.i from t3);
ERROR 42S22: Unknown column 't1.i' in 'field list' ERROR 42S22: Unknown column 't1.i' in 'SELECT'
replace t4 replace t4
select * from t1 left join t2 on (select t1.i from t3); select * from t1 left join t2 on (select t1.i from t3);
ERROR 42S22: Unknown column 't1.i' in 'field list' ERROR 42S22: Unknown column 't1.i' in 'SELECT'
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4;
create table t (a int); create table t (a int);
select 1 in (select count(*) from t t1 join (t t2 join t t3 on (t1.a != 0))); select 1 in (select count(*) from t t1 join (t t2 join t t3 on (t1.a != 0)));
ERROR 42S22: Unknown column 't1.a' in 'on clause' ERROR 42S22: Unknown column 't1.a' in 'ON'
drop table t; drop table t;
# #
# MDEV-28578 Server crashes in Item_field::fix_outer_field after CREATE SELECT # MDEV-28578 Server crashes in Item_field::fix_outer_field after CREATE SELECT
@ -781,7 +781,7 @@ drop table t;
create table t1 (i int) ; create table t1 (i int) ;
create table t2 (j int) ; create table t2 (j int) ;
create table t4 select * from t1 join t2 on (select t3.i); create table t4 select * from t1 join t2 on (select t3.i);
ERROR 42S22: Unknown column 't3.i' in 'field list' ERROR 42S22: Unknown column 't3.i' in 'SELECT'
drop table t1, t2; drop table t1, t2;
# #
# End of 10.4 tests # End of 10.4 tests

View File

@ -482,7 +482,7 @@ INSERT INTO t1 VALUES(1,'a'),(2,'b'),(3,'c');
# SIMLPE INSERT STATEMENT # SIMLPE INSERT STATEMENT
# #
INSERT INTO t2(id2,val2) VALUES(1,'a') RETURNING id1; INSERT INTO t2(id2,val2) VALUES(1,'a') RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
INSERT INTO t2(id2,val2) values(2,'b') RETURNING SUM(id2); INSERT INTO t2(id2,val2) values(2,'b') RETURNING SUM(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
INSERT INTO t2(id2,val2) VALUES(3,'c') RETURNING (SELECT id1 FROM t1); INSERT INTO t2(id2,val2) VALUES(3,'c') RETURNING (SELECT id1 FROM t1);
@ -504,7 +504,7 @@ ERROR 42S02: Unknown table 'test.t1'
# Multiple rows in single insert statement # Multiple rows in single insert statement
# #
INSERT INTO t2 VALUES(1,'a'),(2,'b') RETURNING id1; INSERT INTO t2 VALUES(1,'a'),(2,'b') RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
INSERT INTO t2 VALUES(3,'c'),(4,'d') RETURNING MAX(id2); INSERT INTO t2 VALUES(3,'c'),(4,'d') RETURNING MAX(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
INSERT INTO t2 VALUES(5,'c'),(6,'f') RETURNING (SELECT id1 FROM t1); INSERT INTO t2 VALUES(5,'c'),(6,'f') RETURNING (SELECT id1 FROM t1);
@ -527,7 +527,7 @@ ERROR 42S02: Unknown table 'test.t1'
# INSERT ... SET # INSERT ... SET
# #
INSERT INTO t2 SET id2=1, val2='a' RETURNING id1; INSERT INTO t2 SET id2=1, val2='a' RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
INSERT INTO t2 SET id2=2, val2='b' RETURNING COUNT(id2); INSERT INTO t2 SET id2=2, val2='b' RETURNING COUNT(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
INSERT INTO t2 SET id2=3, val2='c' RETURNING (SELECT id1 FROM t1); INSERT INTO t2 SET id2=3, val2='c' RETURNING (SELECT id1 FROM t1);
@ -550,7 +550,7 @@ ERROR 42S02: Unknown table 'test.t1'
# #
INSERT INTO ins_duplicate VALUES (2,'b') ON DUPLICATE KEY UPDATE val='b' INSERT INTO ins_duplicate VALUES (2,'b') ON DUPLICATE KEY UPDATE val='b'
RETURNING id1; RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
INSERT INTO ins_duplicate VALUES (2,'b') ON DUPLICATE KEY UPDATE val='b' INSERT INTO ins_duplicate VALUES (2,'b') ON DUPLICATE KEY UPDATE val='b'
RETURNING MAX(id); RETURNING MAX(id);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
@ -565,7 +565,7 @@ RETURNING (SELECT * FROM ins_duplicate);
ERROR 21000: Operand should contain 1 column(s) ERROR 21000: Operand should contain 1 column(s)
INSERT INTO ins_duplicate VALUES(2,'b') ON DUPLICATE KEY UPDATE val='b' INSERT INTO ins_duplicate VALUES(2,'b') ON DUPLICATE KEY UPDATE val='b'
RETURNING id2, (SELECT id1+id FROM t1 WHERE id1=1); RETURNING id2, (SELECT id1+id FROM t1 WHERE id1=1);
ERROR 42S22: Unknown column 'id2' in 'field list' ERROR 42S22: Unknown column 'id2' in 'RETURNING'
INSERT INTO ins_duplicate VALUES(2,'b') ON DUPLICATE KEY UPDATE val='b' INSERT INTO ins_duplicate VALUES(2,'b') ON DUPLICATE KEY UPDATE val='b'
RETURNING (SELECT id FROM ins_duplicate); RETURNING (SELECT id FROM ins_duplicate);
ERROR HY000: Table 'ins_duplicate' is specified twice, both as a target for 'INSERT' and as a separate source for data ERROR HY000: Table 'ins_duplicate' is specified twice, both as a target for 'INSERT' and as a separate source for data
@ -576,7 +576,7 @@ ERROR 42S02: Unknown table 'test.t1'
# INSERT...SELECT # INSERT...SELECT
# #
INSERT INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=1 RETURNING id1; INSERT INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=1 RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
INSERT INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=2 RETURNING MAX(id2); INSERT INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=2 RETURNING MAX(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
INSERT INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=2 RETURNING (SELECT INSERT INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=2 RETURNING (SELECT

View File

@ -666,11 +666,11 @@ a
10 10
insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= a + 10; insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= a + 10;
insert into t1 select t2.a from t2 on duplicate key update a= a + t2.b; insert into t1 select t2.a from t2 on duplicate key update a= a + t2.b;
ERROR 23000: Column 'a' in field list is ambiguous ERROR 23000: Column 'a' in UPDATE is ambiguous
insert into t1 select t2.a from t2 on duplicate key update t2.a= a + t2.b; insert into t1 select t2.a from t2 on duplicate key update t2.a= a + t2.b;
ERROR 42S22: Unknown column 't2.a' in 'field list' ERROR 42S22: Unknown column 't2.a' in 'UPDATE'
insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= t1.a + t2.b; insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= t1.a + t2.b;
ERROR 42S22: Unknown column 't2.b' in 'field list' ERROR 42S22: Unknown column 't2.b' in 'UPDATE'
drop table t1,t2,t3; drop table t1,t2,t3;
create table t1(f1 varchar(5) key); create table t1(f1 varchar(5) key);
insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1; insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1;
@ -686,9 +686,9 @@ create table t1(x int, y int);
create table t2(x int, z int); create table t2(x int, z int);
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(x); insert into t1(x,y) select x,z from t2 on duplicate key update x=values(x);
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(z); insert into t1(x,y) select x,z from t2 on duplicate key update x=values(z);
ERROR 42S22: Unknown column 'z' in 'field list' ERROR 42S22: Unknown column 'z' in 'UPDATE'
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x); insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x);
ERROR 42S22: Unknown column 't2.x' in 'field list' ERROR 42S22: Unknown column 't2.x' in 'UPDATE'
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 (a int PRIMARY KEY); CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 values (1), (2); INSERT INTO t1 values (1), (2);

View File

@ -158,7 +158,7 @@ a b c
5 0 30 5 0 30
8 9 60 8 9 60
INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a); INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
ERROR 23000: Column 'c' in field list is ambiguous ERROR 23000: Column 'c' in UPDATE is ambiguous
INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=t1.c+VALUES(t1.a); INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=t1.c+VALUES(t1.a);
SELECT *, VALUE(a) FROM t1; SELECT *, VALUE(a) FROM t1;
a b c VALUE(a) a b c VALUE(a)
@ -191,9 +191,9 @@ a
2 2
3 3
insert into t1 select a from t1 on duplicate key update a=a+1 ; insert into t1 select a from t1 on duplicate key update a=a+1 ;
ERROR 23000: Column 'a' in field list is ambiguous ERROR 23000: Column 'a' in UPDATE is ambiguous
insert ignore into t1 select a from t1 on duplicate key update a=t1.a+1 ; insert ignore into t1 select a from t1 on duplicate key update a=t1.a+1 ;
ERROR 23000: Column 't1.a' in field list is ambiguous ERROR 23000: Column 't1.a' in UPDATE is ambiguous
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a BIGINT(20) NOT NULL DEFAULT 0, a BIGINT(20) NOT NULL DEFAULT 0,
@ -225,7 +225,7 @@ a b
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (i INT PRIMARY KEY, j INT); CREATE TABLE t1 (i INT PRIMARY KEY, j INT);
INSERT INTO t1 SELECT 1, j; INSERT INTO t1 SELECT 1, j;
ERROR 42S22: Unknown column 'j' in 'field list' ERROR 42S22: Unknown column 'j' in 'SELECT'
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (i INT PRIMARY KEY, j INT); CREATE TABLE t1 (i INT PRIMARY KEY, j INT);
CREATE TABLE t2 (a INT, b INT); CREATE TABLE t2 (a INT, b INT);
@ -238,7 +238,7 @@ CREATE TABLE t2 (a INT);
INSERT INTO t1 VALUES (1, 1); INSERT INTO t1 VALUES (1, 1);
INSERT INTO t2 VALUES (1), (3); INSERT INTO t2 VALUES (1), (3);
INSERT INTO t1 SELECT 1, COUNT(*) FROM t2 ON DUPLICATE KEY UPDATE j= a; INSERT INTO t1 SELECT 1, COUNT(*) FROM t2 ON DUPLICATE KEY UPDATE j= a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'UPDATE'
DROP TABLE t1,t2; DROP TABLE t1,t2;
SET SQL_MODE = 'TRADITIONAL'; SET SQL_MODE = 'TRADITIONAL';
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL); CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL);

View File

@ -234,7 +234,7 @@ a d e f
1 d blob 3 1 1 d blob 3 1
1 d blob 41 1 1 d blob 41 1
select a,b,c,d,e,f from t2; select a,b,c,d,e,f from t2;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
drop table t2; drop table t2;
#now this will copy invisible fields #now this will copy invisible fields
create table t2 as select a,b,c,d,e,f from t1; create table t2 as select a,b,c,d,e,f from t1;
@ -310,7 +310,7 @@ a d e f
1 d blob 41 1 1 d blob 41 1
#v does not have invisible column; #v does not have invisible column;
select a,b,c,d,e,f from v; select a,b,c,d,e,f from v;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
insert into v values(1,21,32,4); insert into v values(1,21,32,4);
select * from v; select * from v;
a d e f a d e f
@ -321,7 +321,7 @@ a d e f
1 d blob 41 1 1 d blob 41 1
1 21 32 4 1 21 32 4
insert into v(a,b,c,d,e,f) values(1,12,3,4,5,6); insert into v(a,b,c,d,e,f) values(1,12,3,4,5,6);
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'INSERT INTO'
drop view v; drop view v;
create view v as select a,b,c,d,e,f from t1; create view v as select a,b,c,d,e,f from t1;
desc v; desc v;

View File

@ -16,16 +16,16 @@ select a , invisible from t1;
a invisible a invisible
1 9 1 9
insert into t1(a, invisible) values(99,99); insert into t1(a, invisible) values(99,99);
ERROR 42S22: Unknown column 'invisible' in 'field list' ERROR 42S22: Unknown column 'invisible' in 'INSERT INTO'
select default(invisible) from t1; select default(invisible) from t1;
ERROR 42S22: Unknown column 'invisible' in 'field list' ERROR 42S22: Unknown column 'invisible' in 'SELECT'
insert into t1(invisible) values(99); insert into t1(invisible) values(99);
ERROR 42S22: Unknown column 'invisible' in 'field list' ERROR 42S22: Unknown column 'invisible' in 'INSERT INTO'
insert into t_tmp select a, invisible from t1; insert into t_tmp select a, invisible from t1;
insert into t1 select * from t_tmp; insert into t1 select * from t_tmp;
ERROR 21S01: Column count doesn't match value count at row 1 ERROR 21S01: Column count doesn't match value count at row 1
insert into t1(a,invisible) select * from t_tmp; insert into t1(a,invisible) select * from t_tmp;
ERROR 42S22: Unknown column 'invisible' in 'field list' ERROR 42S22: Unknown column 'invisible' in 'INSERT INTO'
select a , invisible from t1; select a , invisible from t1;
a invisible a invisible
1 9 1 9
@ -45,22 +45,22 @@ select a , invisible from t1;
a invisible a invisible
109 9 109 9
update t1 set invisible = 23 where a=(select a from t1 limit 1); update t1 set invisible = 23 where a=(select a from t1 limit 1);
ERROR 42S22: Unknown column 'invisible' in 'field list' ERROR 42S22: Unknown column 'invisible' in 'SET'
update t1 set invisible = 101 where a=(select a from t1 limit 1); update t1 set invisible = 101 where a=(select a from t1 limit 1);
ERROR 42S22: Unknown column 'invisible' in 'field list' ERROR 42S22: Unknown column 'invisible' in 'SET'
update t1 set invisible = (select invisible+100 from t1 limit 1) where a=(select invisible from t1 limit 1); update t1 set invisible = (select invisible+100 from t1 limit 1) where a=(select invisible from t1 limit 1);
ERROR 42S22: Unknown column 'invisible' in 'field list' ERROR 42S22: Unknown column 'invisible' in 'SET'
select a , invisible from t1; select a , invisible from t1;
a invisible a invisible
109 9 109 9
set @a=12; set @a=12;
update t1 set invisible = (select @a from dual) where a=(select a from t1 limit 1); update t1 set invisible = (select @a from dual) where a=(select a from t1 limit 1);
ERROR 42S22: Unknown column 'invisible' in 'field list' ERROR 42S22: Unknown column 'invisible' in 'SET'
select a , invisible from t1; select a , invisible from t1;
a invisible a invisible
109 9 109 9
update t1 set invisible = (select invisible+100 from t1 limit 1) where a=(select a from t1 limit 1); update t1 set invisible = (select invisible+100 from t1 limit 1) where a=(select a from t1 limit 1);
ERROR 42S22: Unknown column 'invisible' in 'field list' ERROR 42S22: Unknown column 'invisible' in 'SET'
select a , invisible from t1; select a , invisible from t1;
a invisible a invisible
109 9 109 9
@ -100,7 +100,7 @@ select * from t1;
a a
1 1
select invisible ,a from t1; select invisible ,a from t1;
ERROR 42S22: Unknown column 'invisible' in 'field list' ERROR 42S22: Unknown column 'invisible' in 'SELECT'
set debug_dbug= "+d,test_completely_invisible"; set debug_dbug= "+d,test_completely_invisible";
select invisible ,a from t1; select invisible ,a from t1;
invisible a invisible a
@ -108,9 +108,9 @@ invisible a
set debug_dbug=@old_debug; set debug_dbug=@old_debug;
create table t2 (invisible int); create table t2 (invisible int);
select * from t1 join t2 using (invisible); select * from t1 join t2 using (invisible);
ERROR 42S22: Unknown column 'invisible' in 'from clause' ERROR 42S22: Unknown column 'invisible' in 'FROM'
select * from t2 join t1 using (invisible); select * from t2 join t1 using (invisible);
ERROR 42S22: Unknown column 'invisible' in 'from clause' ERROR 42S22: Unknown column 'invisible' in 'FROM'
insert t2 values (8),(9); insert t2 values (8),(9);
select * from t1 natural join t2; select * from t1 natural join t2;
a invisible a invisible

View File

@ -40,7 +40,7 @@ a
2 2
3 3
select invisible,a from t1; select invisible,a from t1;
ERROR 42S22: Unknown column 'invisible' in 'field list' ERROR 42S22: Unknown column 'invisible' in 'SELECT'
delete from t1 where a =1; delete from t1 where a =1;
update t1 set a=1 where a=3; update t1 set a=1 where a=3;
select * from t1; select * from t1;

View File

@ -727,31 +727,31 @@ b c a c b y
1 10 2 3 1 2 1 10 2 3 1 2
1 3 2 3 1 2 1 3 2 3 1 2
select * from t1 natural join (t3 cross join t4); select * from t1 natural join (t3 cross join t4);
ERROR 23000: Column 'c' in from clause is ambiguous ERROR 23000: Column 'c' in FROM is ambiguous
select * from (t3 cross join t4) natural join t1; select * from (t3 cross join t4) natural join t1;
ERROR 23000: Column 'c' in from clause is ambiguous ERROR 23000: Column 'c' in FROM is ambiguous
select * from t1 join (t2, t3) using (b); select * from t1 join (t2, t3) using (b);
ERROR 23000: Column 'b' in from clause is ambiguous ERROR 23000: Column 'b' in FROM is ambiguous
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6; select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
ERROR 23000: Column 'c' in from clause is ambiguous ERROR 23000: Column 'c' in FROM is ambiguous
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6; select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
ERROR 23000: Column 'c' in from clause is ambiguous ERROR 23000: Column 'c' in FROM is ambiguous
select * from t6 natural join ((t1 natural join t2), (t3 natural join t4)); select * from t6 natural join ((t1 natural join t2), (t3 natural join t4));
ERROR 23000: Column 'c' in from clause is ambiguous ERROR 23000: Column 'c' in FROM is ambiguous
select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4); select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4);
ERROR 23000: Column 'b' in from clause is ambiguous ERROR 23000: Column 'b' in FROM is ambiguous
select * from (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b); select * from (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b);
ERROR 23000: Column 'b' in from clause is ambiguous ERROR 23000: Column 'b' in FROM is ambiguous
select * from (t3 join (t4 natural join t5) on (b < z)) select * from (t3 join (t4 natural join t5) on (b < z))
natural join natural join
(t1 natural join t2); (t1 natural join t2);
ERROR 23000: Column 'c' in from clause is ambiguous ERROR 23000: Column 'c' in FROM is ambiguous
select * from (t1 natural join t2) natural join (t3 join (t4 natural join t5) on (b < z)); select * from (t1 natural join t2) natural join (t3 join (t4 natural join t5) on (b < z));
ERROR 23000: Column 'c' in from clause is ambiguous ERROR 23000: Column 'c' in FROM is ambiguous
select t1.b from v1a; select t1.b from v1a;
ERROR 42S22: Unknown column 't1.b' in 'field list' ERROR 42S22: Unknown column 't1.b' in 'SELECT'
select * from v1a join v1b on t1.b = t2.b; select * from v1a join v1b on t1.b = t2.b;
ERROR 42S22: Unknown column 't1.b' in 'on clause' ERROR 42S22: Unknown column 't1.b' in 'ON'
select select
statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statistics.TABLE_SCHEMA, statistics.NON_UNIQUE, statistics.INDEX_SCHEMA, statistics.INDEX_NAME, statistics.SEQ_IN_INDEX, statistics.COLLATION, statistics.SUB_PART, statistics.PACKED, statistics.NULLABLE, statistics.INDEX_TYPE, statistics.COMMENT, statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statistics.TABLE_SCHEMA, statistics.NON_UNIQUE, statistics.INDEX_SCHEMA, statistics.INDEX_NAME, statistics.SEQ_IN_INDEX, statistics.COLLATION, statistics.SUB_PART, statistics.PACKED, statistics.NULLABLE, statistics.INDEX_TYPE, statistics.COMMENT,
columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_NULLABLE, columns.DATA_TYPE, columns.CHARACTER_MAXIMUM_LENGTH, columns.CHARACTER_OCTET_LENGTH, columns.NUMERIC_PRECISION, columns.NUMERIC_SCALE, columns.CHARACTER_SET_NAME, columns.COLLATION_NAME, columns.COLUMN_TYPE, columns.COLUMN_KEY, columns.EXTRA, columns.COLUMN_COMMENT columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_NULLABLE, columns.DATA_TYPE, columns.CHARACTER_MAXIMUM_LENGTH, columns.CHARACTER_OCTET_LENGTH, columns.NUMERIC_PRECISION, columns.NUMERIC_SCALE, columns.CHARACTER_SET_NAME, columns.COLLATION_NAME, columns.COLUMN_TYPE, columns.COLUMN_KEY, columns.EXTRA, columns.COLUMN_COMMENT
@ -1519,12 +1519,12 @@ SET optimizer_switch=@save_optimizer_switch;
CREATE TABLE t (i INT); CREATE TABLE t (i INT);
CREATE PROCEDURE p() SELECT t1.f FROM t AS t1 JOIN t AS t2 USING (f); CREATE PROCEDURE p() SELECT t1.f FROM t AS t1 JOIN t AS t2 USING (f);
CALL p; CALL p;
ERROR 42S22: Unknown column 'f' in 'from clause' ERROR 42S22: Unknown column 'f' in 'FROM'
CALL p; CALL p;
ERROR 42S22: Unknown column 'f' in 'from clause' ERROR 42S22: Unknown column 'f' in 'FROM'
FLUSH TABLES; FLUSH TABLES;
CALL p; CALL p;
ERROR 42S22: Unknown column 'f' in 'from clause' ERROR 42S22: Unknown column 'f' in 'FROM'
DROP TABLE t; DROP TABLE t;
CREATE TABLE t (f INT); CREATE TABLE t (f INT);
CALL p; CALL p;
@ -1532,9 +1532,9 @@ f
DROP TABLE t; DROP TABLE t;
CREATE TABLE t (i INT); CREATE TABLE t (i INT);
CALL p; CALL p;
ERROR 42S22: Unknown column 't1.f' in 'field list' ERROR 42S22: Unknown column 't1.f' in 'SELECT'
CALL p; CALL p;
ERROR 42S22: Unknown column 't1.f' in 'field list' ERROR 42S22: Unknown column 't1.f' in 'SELECT'
DROP PROCEDURE p; DROP PROCEDURE p;
DROP TABLE t; DROP TABLE t;
CREATE TABLE t1 (a INT, b INT); CREATE TABLE t1 (a INT, b INT);
@ -1545,9 +1545,9 @@ CREATE TABLE t5 (a INT, c INT);
CREATE PROCEDURE p1() SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a) CREATE PROCEDURE p1() SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a)
LEFT JOIN t5 USING (a)) USING (a); LEFT JOIN t5 USING (a)) USING (a);
CALL p1; CALL p1;
ERROR 23000: Column 'c' in field list is ambiguous ERROR 23000: Column 'c' in SELECT is ambiguous
CALL p1; CALL p1;
ERROR 23000: Column 'c' in field list is ambiguous ERROR 23000: Column 'c' in SELECT is ambiguous
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1,t2,t3,t4,t5; DROP TABLE t1,t2,t3,t4,t5;
# #

View File

@ -1401,19 +1401,19 @@ SELECT e FROM t5 NATURAL JOIN t6;
SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d); SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
a a
SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d); SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 't1.x' in 'field list' ERROR 42S22: Unknown column 't1.x' in 'SELECT'
SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4; SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
a a
SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4; SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
ERROR 42S22: Unknown column 't1.x' in 'field list' ERROR 42S22: Unknown column 't1.x' in 'SELECT'
SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d); SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
e e
SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d); SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 'v1.x' in 'field list' ERROR 42S22: Unknown column 'v1.x' in 'SELECT'
SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d); SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
e e
SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d); SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 'v2.x' in 'field list' ERROR 42S22: Unknown column 'v2.x' in 'SELECT'
DROP VIEW v1, v2; DROP VIEW v1, v2;
DROP TABLE t1, t2, t3, t4, t5, t6; DROP TABLE t1, t2, t3, t4, t5, t6;
create table t1 (id1 int(11) not null); create table t1 (id1 int(11) not null);
@ -1628,13 +1628,13 @@ LEFT JOIN t5 USING (a)) USING (a);
b b
SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a) SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a)
LEFT JOIN t5 USING (a)) USING (a); LEFT JOIN t5 USING (a)) USING (a);
ERROR 23000: Column 'c' in field list is ambiguous ERROR 23000: Column 'c' in SELECT is ambiguous
SELECT b FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a) SELECT b FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a)
JOIN t5 USING (a)) USING (a); JOIN t5 USING (a)) USING (a);
b b
SELECT c FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a) SELECT c FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a)
JOIN t5 USING (a)) USING (a); JOIN t5 USING (a)) USING (a);
ERROR 23000: Column 'c' in field list is ambiguous ERROR 23000: Column 'c' in SELECT is ambiguous
DROP TABLE t1,t2,t3,t4,t5; DROP TABLE t1,t2,t3,t4,t5;
CREATE TABLE t1 (a INT, b INT); CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT, b INT); CREATE TABLE t2 (a INT, b INT);
@ -1643,7 +1643,7 @@ INSERT INTO t1 VALUES (1,1);
INSERT INTO t2 VALUES (1,1); INSERT INTO t2 VALUES (1,1);
INSERT INTO t3 VALUES (1,1); INSERT INTO t3 VALUES (1,1);
SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a); SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a);
ERROR 23000: Column 'a' in from clause is ambiguous ERROR 23000: Column 'a' in FROM is ambiguous
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
CREATE TABLE t1 ( CREATE TABLE t1 (
carrier char(2) default NULL, carrier char(2) default NULL,

View File

@ -1410,19 +1410,19 @@ SELECT e FROM t5 NATURAL JOIN t6;
SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d); SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
a a
SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d); SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 't1.x' in 'field list' ERROR 42S22: Unknown column 't1.x' in 'SELECT'
SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4; SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
a a
SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4; SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
ERROR 42S22: Unknown column 't1.x' in 'field list' ERROR 42S22: Unknown column 't1.x' in 'SELECT'
SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d); SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
e e
SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d); SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 'v1.x' in 'field list' ERROR 42S22: Unknown column 'v1.x' in 'SELECT'
SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d); SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
e e
SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d); SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 'v2.x' in 'field list' ERROR 42S22: Unknown column 'v2.x' in 'SELECT'
DROP VIEW v1, v2; DROP VIEW v1, v2;
DROP TABLE t1, t2, t3, t4, t5, t6; DROP TABLE t1, t2, t3, t4, t5, t6;
create table t1 (id1 int(11) not null); create table t1 (id1 int(11) not null);
@ -1637,13 +1637,13 @@ LEFT JOIN t5 USING (a)) USING (a);
b b
SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a) SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a)
LEFT JOIN t5 USING (a)) USING (a); LEFT JOIN t5 USING (a)) USING (a);
ERROR 23000: Column 'c' in field list is ambiguous ERROR 23000: Column 'c' in SELECT is ambiguous
SELECT b FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a) SELECT b FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a)
JOIN t5 USING (a)) USING (a); JOIN t5 USING (a)) USING (a);
b b
SELECT c FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a) SELECT c FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a)
JOIN t5 USING (a)) USING (a); JOIN t5 USING (a)) USING (a);
ERROR 23000: Column 'c' in field list is ambiguous ERROR 23000: Column 'c' in SELECT is ambiguous
DROP TABLE t1,t2,t3,t4,t5; DROP TABLE t1,t2,t3,t4,t5;
CREATE TABLE t1 (a INT, b INT); CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT, b INT); CREATE TABLE t2 (a INT, b INT);
@ -1652,7 +1652,7 @@ INSERT INTO t1 VALUES (1,1);
INSERT INTO t2 VALUES (1,1); INSERT INTO t2 VALUES (1,1);
INSERT INTO t3 VALUES (1,1); INSERT INTO t3 VALUES (1,1);
SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a); SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a);
ERROR 23000: Column 'a' in from clause is ambiguous ERROR 23000: Column 'a' in FROM is ambiguous
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
CREATE TABLE t1 ( CREATE TABLE t1 (
carrier char(2) default NULL, carrier char(2) default NULL,

View File

@ -110,11 +110,11 @@ grp a c id a c d a
3 6 D 3 6 C 6 6 3 6 D 3 6 C 6 6
NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a); explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
ERROR 42S22: Unknown column 't3.a' in 'on clause' ERROR 42S22: Unknown column 't3.a' in 'ON'
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a); select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
ERROR 42S22: Unknown column 't3.a' in 'on clause' ERROR 42S22: Unknown column 't3.a' in 'ON'
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a); select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
ERROR 42S22: Unknown column 't3.a' in 'on clause' ERROR 42S22: Unknown column 't3.a' in 'ON'
select t1.*,t2.* from t1 inner join t2 using (a); select t1.*,t2.* from t1 inner join t2 using (a);
grp a c id a c d grp a c id a c d
1 1 a 1 1 a 1 1 1 a 1 1 a 1
@ -404,7 +404,7 @@ insert into t3 values (1);
insert into t4 values (1,1); insert into t4 values (1,1);
insert into t5 values (1,1); insert into t5 values (1,1);
explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23; explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23;
ERROR 42S22: Unknown column 't2.t2_id' in 'on clause' ERROR 42S22: Unknown column 't2.t2_id' in 'ON'
drop table t1,t2,t3,t4,t5; drop table t1,t2,t3,t4,t5;
create table t1 (n int, m int, o int, key(n)); create table t1 (n int, m int, o int, key(n));
create table t2 (n int not null, m int, o int, primary key(n)); create table t2 (n int not null, m int, o int, primary key(n));
@ -2703,7 +2703,7 @@ join
t3 on t3 on
(t3.f=t1.a) (t3.f=t1.a)
) on (t2.c=t1.a ); ) on (t2.c=t1.a );
ERROR 42S22: Unknown column 't1.a' in 'on clause' ERROR 42S22: Unknown column 't1.a' in 'ON'
explain explain
select * select *
from from
@ -2713,7 +2713,7 @@ join
t3 on t3 on
(t3.f=(select max(g) from t4 where t4.h=t1.a)) (t3.f=(select max(g) from t4 where t4.h=t1.a))
) on (t2.c=t1.a ); ) on (t2.c=t1.a );
ERROR 42S22: Unknown column 't1.a' in 'where clause' ERROR 42S22: Unknown column 't1.a' in 'WHERE'
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4;
create table t1 (a int); create table t1 (a int);
insert into t1 values (1),(2); insert into t1 values (1),(2);
@ -2724,7 +2724,7 @@ insert into t3 values (1),(2);
select * from ( select * from t1 left join t2 select * from ( select * from t1 left join t2
on b in (select x from t3 as sq1) on b in (select x from t3 as sq1)
) as sq2; ) as sq2;
ERROR 42S22: Unknown column 'x' in 'field list' ERROR 42S22: Unknown column 'x' in 'SELECT'
drop table t1,t2,t3; drop table t1,t2,t3;
# end of 10.2 tests # end of 10.2 tests
# #

View File

@ -117,11 +117,11 @@ grp a c id a c d a
3 6 D 3 6 C 6 6 3 6 D 3 6 C 6 6
NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a); explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
ERROR 42S22: Unknown column 't3.a' in 'on clause' ERROR 42S22: Unknown column 't3.a' in 'ON'
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a); select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
ERROR 42S22: Unknown column 't3.a' in 'on clause' ERROR 42S22: Unknown column 't3.a' in 'ON'
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a); select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
ERROR 42S22: Unknown column 't3.a' in 'on clause' ERROR 42S22: Unknown column 't3.a' in 'ON'
select t1.*,t2.* from t1 inner join t2 using (a); select t1.*,t2.* from t1 inner join t2 using (a);
grp a c id a c d grp a c id a c d
1 1 a 1 1 a 1 1 1 a 1 1 a 1
@ -411,7 +411,7 @@ insert into t3 values (1);
insert into t4 values (1,1); insert into t4 values (1,1);
insert into t5 values (1,1); insert into t5 values (1,1);
explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23; explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23;
ERROR 42S22: Unknown column 't2.t2_id' in 'on clause' ERROR 42S22: Unknown column 't2.t2_id' in 'ON'
drop table t1,t2,t3,t4,t5; drop table t1,t2,t3,t4,t5;
create table t1 (n int, m int, o int, key(n)); create table t1 (n int, m int, o int, key(n));
create table t2 (n int not null, m int, o int, primary key(n)); create table t2 (n int not null, m int, o int, primary key(n));
@ -2710,7 +2710,7 @@ join
t3 on t3 on
(t3.f=t1.a) (t3.f=t1.a)
) on (t2.c=t1.a ); ) on (t2.c=t1.a );
ERROR 42S22: Unknown column 't1.a' in 'on clause' ERROR 42S22: Unknown column 't1.a' in 'ON'
explain explain
select * select *
from from
@ -2720,7 +2720,7 @@ join
t3 on t3 on
(t3.f=(select max(g) from t4 where t4.h=t1.a)) (t3.f=(select max(g) from t4 where t4.h=t1.a))
) on (t2.c=t1.a ); ) on (t2.c=t1.a );
ERROR 42S22: Unknown column 't1.a' in 'where clause' ERROR 42S22: Unknown column 't1.a' in 'WHERE'
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4;
create table t1 (a int); create table t1 (a int);
insert into t1 values (1),(2); insert into t1 values (1),(2);
@ -2731,7 +2731,7 @@ insert into t3 values (1),(2);
select * from ( select * from t1 left join t2 select * from ( select * from t1 left join t2
on b in (select x from t3 as sq1) on b in (select x from t3 as sq1)
) as sq2; ) as sq2;
ERROR 42S22: Unknown column 'x' in 'field list' ERROR 42S22: Unknown column 'x' in 'SELECT'
drop table t1,t2,t3; drop table t1,t2,t3;
# end of 10.2 tests # end of 10.2 tests
# #

View File

@ -579,62 +579,62 @@ SELECT test.year(); -- FUNCTION test.year does not exist. Check
SELECT test.create(); -- FUNCTION test.create does not exist. Che SELECT test.create(); -- FUNCTION test.create does not exist. Che
CALL p2('SELECT $(VAR) FROM t1'); CALL p2('SELECT $(VAR) FROM t1');
-------- --------
SELECT non_keyword FROM t1; -- Unknown column 'non_keyword' in 'field l SELECT non_keyword FROM t1; -- Unknown column 'non_keyword' in 'SELECT'
-------- --------
SELECT lpad FROM t1; -- Unknown column 'lpad' in 'field list' SELECT lpad FROM t1; -- Unknown column 'lpad' in 'SELECT'
-------- --------
SELECT rpad FROM t1; -- Unknown column 'rpad' in 'field list' SELECT rpad FROM t1; -- Unknown column 'rpad' in 'SELECT'
-------- --------
SELECT adddate FROM t1; -- Unknown column 'adddate' in 'field list' SELECT adddate FROM t1; -- Unknown column 'adddate' in 'SELECT'
-------- --------
SELECT substr FROM t1; -- Unknown column 'substr' in 'field list' SELECT substr FROM t1; -- Unknown column 'substr' in 'SELECT'
-------- --------
SELECT substring FROM t1; -- Unknown column 'substring' in 'field lis SELECT substring FROM t1; -- Unknown column 'substring' in 'SELECT'
-------- --------
SELECT trim_oracle FROM t1; -- Unknown column 'trim_oracle' in 'field l SELECT trim_oracle FROM t1; -- Unknown column 'trim_oracle' in 'SELECT'
-------- --------
SELECT ascii FROM t1; -- Unknown column 'ascii' in 'field list' SELECT ascii FROM t1; -- Unknown column 'ascii' in 'SELECT'
-------- --------
SELECT replace FROM t1; -- ..syntax.. near 'FROM t1' at line 1 SELECT replace FROM t1; -- ..syntax.. near 'FROM t1' at line 1
-------- --------
SELECT weight_string FROM t1; -- Unknown column 'weight_string' in 'field SELECT weight_string FROM t1; -- Unknown column 'weight_string' in 'SELEC
-------- --------
SELECT char FROM t1; -- ..syntax.. near 'FROM t1' at line 1 SELECT char FROM t1; -- ..syntax.. near 'FROM t1' at line 1
-------- --------
SELECT trim FROM t1; -- Unknown column 'trim' in 'field list' SELECT trim FROM t1; -- Unknown column 'trim' in 'SELECT'
-------- --------
SELECT year FROM t1; -- Unknown column 'year' in 'field list' SELECT year FROM t1; -- Unknown column 'year' in 'SELECT'
-------- --------
SELECT create FROM t1; -- ..syntax.. near 'create FROM t1' at line SELECT create FROM t1; -- ..syntax.. near 'create FROM t1' at line
CALL p2('SELECT t1.$(VAR) FROM t1'); CALL p2('SELECT t1.$(VAR) FROM t1');
-------- --------
SELECT t1.non_keyword FROM t1; -- Unknown column 't1.non_keyword' in 'fiel SELECT t1.non_keyword FROM t1; -- Unknown column 't1.non_keyword' in 'SELE
-------- --------
SELECT t1.lpad FROM t1; -- Unknown column 't1.lpad' in 'field list' SELECT t1.lpad FROM t1; -- Unknown column 't1.lpad' in 'SELECT'
-------- --------
SELECT t1.rpad FROM t1; -- Unknown column 't1.rpad' in 'field list' SELECT t1.rpad FROM t1; -- Unknown column 't1.rpad' in 'SELECT'
-------- --------
SELECT t1.adddate FROM t1; -- Unknown column 't1.adddate' in 'field li SELECT t1.adddate FROM t1; -- Unknown column 't1.adddate' in 'SELECT'
-------- --------
SELECT t1.substr FROM t1; -- Unknown column 't1.substr' in 'field lis SELECT t1.substr FROM t1; -- Unknown column 't1.substr' in 'SELECT'
-------- --------
SELECT t1.substring FROM t1; -- Unknown column 't1.substring' in 'field SELECT t1.substring FROM t1; -- Unknown column 't1.substring' in 'SELECT
-------- --------
SELECT t1.trim_oracle FROM t1; -- Unknown column 't1.trim_oracle' in 'fiel SELECT t1.trim_oracle FROM t1; -- Unknown column 't1.trim_oracle' in 'SELE
-------- --------
SELECT t1.ascii FROM t1; -- Unknown column 't1.ascii' in 'field list SELECT t1.ascii FROM t1; -- Unknown column 't1.ascii' in 'SELECT'
-------- --------
SELECT t1.replace FROM t1; -- Unknown column 't1.replace' in 'field li SELECT t1.replace FROM t1; -- Unknown column 't1.replace' in 'SELECT'
-------- --------
SELECT t1.weight_string FROM t1; -- Unknown column 't1.weight_string' in 'fi SELECT t1.weight_string FROM t1; -- Unknown column 't1.weight_string' in 'SE
-------- --------
SELECT t1.char FROM t1; -- Unknown column 't1.char' in 'field list' SELECT t1.char FROM t1; -- Unknown column 't1.char' in 'SELECT'
-------- --------
SELECT t1.trim FROM t1; -- Unknown column 't1.trim' in 'field list' SELECT t1.trim FROM t1; -- Unknown column 't1.trim' in 'SELECT'
-------- --------
SELECT t1.year FROM t1; -- Unknown column 't1.year' in 'field list' SELECT t1.year FROM t1; -- Unknown column 't1.year' in 'SELECT'
-------- --------
SELECT t1.create FROM t1; -- Unknown column 't1.create' in 'field lis SELECT t1.create FROM t1; -- Unknown column 't1.create' in 'SELECT'
CALL p2('DROP TABLE $(VAR)'); CALL p2('DROP TABLE $(VAR)');
-------- --------
DROP TABLE non_keyword; -- Unknown table 'test.non_keyword' DROP TABLE non_keyword; -- Unknown table 'test.non_keyword'

View File

@ -184,4 +184,4 @@ DROP TABLE t1, t2;
# KILL QUERY ID USER # KILL QUERY ID USER
# #
kill query id user 'foo'; kill query id user 'foo';
ERROR 42S22: Unknown column 'user' in 'field list' ERROR 42S22: Unknown column 'user' in 'KILL'

View File

@ -311,7 +311,7 @@ date_format('2001-09-01', '%c %b %M', 'de_CH')
# #
SET lc_messages=ZH_CN; SET lc_messages=ZH_CN;
SELECT x; SELECT x;
ERROR 42S22: 未知列'x'在'field list' ERROR 42S22: 未知列'x'在'SELECT'
SET lc_messages=DEFAULT; SET lc_messages=DEFAULT;
# #
# End of 10.4 tests # End of 10.4 tests

View File

@ -81,7 +81,7 @@ NULL
maria maria
sachin sachin
select db_row_hash_1 from t1; select db_row_hash_1 from t1;
ERROR 42S22: Unknown column 'db_row_hash_1' in 'field list' ERROR 42S22: Unknown column 'db_row_hash_1' in 'SELECT'
#duplicate entry test; #duplicate entry test;
insert into t1 values(2); insert into t1 values(2);
ERROR 23000: Duplicate entry '2' for key 'a' ERROR 23000: Duplicate entry '2' for key 'a'
@ -154,7 +154,7 @@ ERROR 23000: Duplicate entry '1' for key 'a'
insert into t1 values(2,2); insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'a' ERROR 23000: Duplicate entry '2' for key 'a'
select db_row_hash_1 from t1; select db_row_hash_1 from t1;
ERROR 42S22: Unknown column 'db_row_hash_1' in 'field list' ERROR 42S22: Unknown column 'db_row_hash_1' in 'SELECT'
#now try to change db_row_hash_1 column; #now try to change db_row_hash_1 column;
alter table t1 drop column db_row_hash_1; alter table t1 drop column db_row_hash_1;
ERROR 42000: Can't DROP COLUMN `db_row_hash_1`; check that it exists ERROR 42000: Can't DROP COLUMN `db_row_hash_1`; check that it exists
@ -405,11 +405,11 @@ a b c d e
maria 345 frter dasd utyuty maria 345 frter dasd utyuty
sachin 341 fdf gfgfgfg hghgr sachin 341 fdf gfgfgfg hghgr
select db_row_hash_1 from t1; select db_row_hash_1 from t1;
ERROR 42S22: Unknown column 'db_row_hash_1' in 'field list' ERROR 42S22: Unknown column 'db_row_hash_1' in 'SELECT'
select db_row_hash_2 from t1; select db_row_hash_2 from t1;
ERROR 42S22: Unknown column 'db_row_hash_2' in 'field list' ERROR 42S22: Unknown column 'db_row_hash_2' in 'SELECT'
select db_row_hash_3 from t1; select db_row_hash_3 from t1;
ERROR 42S22: Unknown column 'db_row_hash_3' in 'field list' ERROR 42S22: Unknown column 'db_row_hash_3' in 'SELECT'
#duplicate entry test; #duplicate entry test;
insert into t1 values(21,2,3,42,51); insert into t1 values(21,2,3,42,51);
ERROR 23000: Duplicate entry '3' for key 'c' ERROR 23000: Duplicate entry '3' for key 'c'
@ -462,7 +462,7 @@ t1 CREATE TABLE `t1` (
insert into t1 values(1,2,3,4,5,6); insert into t1 values(1,2,3,4,5,6);
ERROR 23000: Duplicate entry '1' for key 'a' ERROR 23000: Duplicate entry '1' for key 'a'
select db_row_hash_1 , db_row_hash_2, db_row_hash_3 from t1; select db_row_hash_1 , db_row_hash_2, db_row_hash_3 from t1;
ERROR 42S22: Unknown column 'db_row_hash_1' in 'field list' ERROR 42S22: Unknown column 'db_row_hash_1' in 'SELECT'
#now try to change db_row_hash_1 column; #now try to change db_row_hash_1 column;
alter table t1 drop column db_row_hash_1, drop column db_row_hash_2, drop column db_row_hash_3; alter table t1 drop column db_row_hash_1, drop column db_row_hash_2, drop column db_row_hash_3;
ERROR 42000: Can't DROP COLUMN `db_row_hash_1`; check that it exists ERROR 42000: Can't DROP COLUMN `db_row_hash_1`; check that it exists
@ -786,11 +786,11 @@ NULL NULL NULL NULL NULL NULL NULL NULL
maria 6 maria maria maria maria 6 maria maria 6 maria maria maria maria 6 maria
mariadb 7 mariadb mariadb mariadb mariadb 8 mariadb mariadb 7 mariadb mariadb mariadb mariadb 8 mariadb
select db_row_hash_1 from t1; select db_row_hash_1 from t1;
ERROR 42S22: Unknown column 'db_row_hash_1' in 'field list' ERROR 42S22: Unknown column 'db_row_hash_1' in 'SELECT'
select db_row_hash_2 from t1; select db_row_hash_2 from t1;
ERROR 42S22: Unknown column 'db_row_hash_2' in 'field list' ERROR 42S22: Unknown column 'db_row_hash_2' in 'SELECT'
select db_row_hash_3 from t1; select db_row_hash_3 from t1;
ERROR 42S22: Unknown column 'db_row_hash_3' in 'field list' ERROR 42S22: Unknown column 'db_row_hash_3' in 'SELECT'
#duplicate entry test; #duplicate entry test;
#duplicate keys entry; #duplicate keys entry;
insert into t1 values(1,1,1,0,0,0,0,0); insert into t1 values(1,1,1,0,0,0,0,0);
@ -806,7 +806,7 @@ ERROR 23000: Duplicate entry '1-1-1-1' for key 'e'
insert into t1 values(1,1,1,1,1,1,1,1); insert into t1 values(1,1,1,1,1,1,1,1);
ERROR 23000: Duplicate entry '1-1-1' for key 'a' ERROR 23000: Duplicate entry '1-1-1' for key 'a'
select db_row_hash_1,db_row_hash_2,db_row_hash_3,db_row_hash_4,db_row_hash_5 from t1; select db_row_hash_1,db_row_hash_2,db_row_hash_3,db_row_hash_4,db_row_hash_5 from t1;
ERROR 42S22: Unknown column 'db_row_hash_1' in 'field list' ERROR 42S22: Unknown column 'db_row_hash_1' in 'SELECT'
alter table t1 drop column db_row_hash_1, drop column db_row_hash_2, drop column db_row_hash_3; alter table t1 drop column db_row_hash_1, drop column db_row_hash_2, drop column db_row_hash_3;
ERROR 42000: Can't DROP COLUMN `db_row_hash_1`; check that it exists ERROR 42000: Can't DROP COLUMN `db_row_hash_1`; check that it exists
alter table t1 add column dg int , add column ef int , drop column db_row_hash_1; alter table t1 add column dg int , add column ef int , drop column db_row_hash_1;
@ -1170,7 +1170,7 @@ DB_ROW_HASH_1 DB_ROW_HASH_2
33 3 33 3
44 4 44 4
select DB_ROW_HASH_1, DB_ROW_HASH_2 from t1; select DB_ROW_HASH_1, DB_ROW_HASH_2 from t1;
ERROR 42S22: Unknown column 'DB_ROW_HASH_1' in 'field list' ERROR 42S22: Unknown column 'DB_ROW_HASH_1' in 'SELECT'
#bug #bug
select DB_ROW_HASH_1, DB_ROW_HASH_2 from t1,t2; select DB_ROW_HASH_1, DB_ROW_HASH_2 from t1,t2;
DB_ROW_HASH_1 DB_ROW_HASH_2 DB_ROW_HASH_1 DB_ROW_HASH_2
@ -1191,7 +1191,7 @@ DB_ROW_HASH_1 DB_ROW_HASH_2
44 4 44 4
44 4 44 4
select * from t1 where DB_ROW_HASH_1 in (select DB_ROW_HASH_1 from t2); select * from t1 where DB_ROW_HASH_1 in (select DB_ROW_HASH_1 from t2);
ERROR 42S22: Unknown column 'DB_ROW_HASH_1' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'DB_ROW_HASH_1' in 'IN/ALL/ANY'
select DB_ROW_HASH_1, DB_ROW_HASH_2 from t1,t2 where DB_ROW_HASH_1 in (select DB_ROW_HASH_1 from t2); select DB_ROW_HASH_1, DB_ROW_HASH_2 from t1,t2 where DB_ROW_HASH_1 in (select DB_ROW_HASH_1 from t2);
DB_ROW_HASH_1 DB_ROW_HASH_2 DB_ROW_HASH_1 DB_ROW_HASH_2
11 1 11 1
@ -1217,7 +1217,7 @@ DB_ROW_HASH_1 DB_ROW_HASH_2
33 3 33 3
44 4 44 4
select DB_ROW_HASH_1 from t1,t2 where t1.DB_ROW_HASH_1 = t2.DB_ROW_HASH_2; select DB_ROW_HASH_1 from t1,t2 where t1.DB_ROW_HASH_1 = t2.DB_ROW_HASH_2;
ERROR 42S22: Unknown column 't1.DB_ROW_HASH_1' in 'where clause' ERROR 42S22: Unknown column 't1.DB_ROW_HASH_1' in 'WHERE'
select DB_ROW_HASH_1 from t1 inner join t2 on t1.a = t2.DB_ROW_HASH_2; select DB_ROW_HASH_1 from t1 inner join t2 on t1.a = t2.DB_ROW_HASH_2;
DB_ROW_HASH_1 DB_ROW_HASH_1
11 11

View File

@ -42,7 +42,7 @@ CREATE TABLE t4 (f1 VARCHAR(10), f2 INT) ENGINE=MyISAM;
SELECT * FROM t1; SELECT * FROM t1;
pk pk
SELECT non_existing FROM v2; SELECT non_existing FROM v2;
ERROR 42S22: Unknown column 'non_existing' in 'field list' ERROR 42S22: Unknown column 'non_existing' in 'SELECT'
SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5; SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5;
pk f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f1 f2 pk f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f1 f2
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4;

View File

@ -993,19 +993,19 @@ create view v2 as select * from t2;
create view v3 as select * from t2 where c0 < 3; create view v3 as select * from t2 where c0 < 3;
create procedure sp0() update t1, v2 set v2.pk = 1 where v2.c0 = t1.c1; create procedure sp0() update t1, v2 set v2.pk = 1 where v2.c0 = t1.c1;
call sp0(); call sp0();
ERROR 42S22: Unknown column 't1.c1' in 'where clause' ERROR 42S22: Unknown column 't1.c1' in 'WHERE'
call sp0(); call sp0();
ERROR 42S22: Unknown column 't1.c1' in 'where clause' ERROR 42S22: Unknown column 't1.c1' in 'WHERE'
create procedure sp1() update (t1 join v2 on v2.c0 = t1.c1) set v2.pk = 1; create procedure sp1() update (t1 join v2 on v2.c0 = t1.c1) set v2.pk = 1;
call sp1(); call sp1();
ERROR 42S22: Unknown column 't1.c1' in 'on clause' ERROR 42S22: Unknown column 't1.c1' in 'ON'
call sp1(); call sp1();
ERROR 42S22: Unknown column 't1.c1' in 'on clause' ERROR 42S22: Unknown column 't1.c1' in 'ON'
create procedure sp2() update (t1 join v3 on v3.c0 = t1.c1) set v3.pk = 1; create procedure sp2() update (t1 join v3 on v3.c0 = t1.c1) set v3.pk = 1;
call sp2(); call sp2();
ERROR 42S22: Unknown column 't1.c1' in 'on clause' ERROR 42S22: Unknown column 't1.c1' in 'ON'
call sp2(); call sp2();
ERROR 42S22: Unknown column 't1.c1' in 'on clause' ERROR 42S22: Unknown column 't1.c1' in 'ON'
create procedure sp3() create procedure sp3()
update (t1 join v2 on v2.c0 = t1.id) set v2.c0 = v2.c0+1; update (t1 join v2 on v2.c0 = t1.id) set v2.c0 = v2.c0+1;
select * from t2; select * from t2;
@ -1024,9 +1024,9 @@ pk c0
2 3 2 3
create procedure sp4() delete t1 from t1 join v2 on v2.c0 = t1.c1; create procedure sp4() delete t1 from t1 join v2 on v2.c0 = t1.c1;
call sp4(); call sp4();
ERROR 42S22: Unknown column 't1.c1' in 'on clause' ERROR 42S22: Unknown column 't1.c1' in 'ON'
call sp4(); call sp4();
ERROR 42S22: Unknown column 't1.c1' in 'on clause' ERROR 42S22: Unknown column 't1.c1' in 'ON'
drop procedure sp0; drop procedure sp0;
drop procedure sp1; drop procedure sp1;
drop procedure sp2; drop procedure sp2;

View File

@ -2927,16 +2927,16 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2), (3); INSERT INTO t1 VALUES (1), (2), (3);
DELETE FROM t1 USING t1 WHERE uknown_column = 12345; DELETE FROM t1 USING t1 WHERE uknown_column = 12345;
ERROR 42S22: Unknown column 'uknown_column' in 'where clause' ERROR 42S22: Unknown column 'uknown_column' in 'WHERE'
EXPLAIN EXTENDED DELETE FROM t1 USING t1 WHERE uknown_column = 12345; EXPLAIN EXTENDED DELETE FROM t1 USING t1 WHERE uknown_column = 12345;
ERROR 42S22: Unknown column 'uknown_column' in 'where clause' ERROR 42S22: Unknown column 'uknown_column' in 'WHERE'
DROP TABLE t1; DROP TABLE t1;
#57 #57
CREATE TABLE t1(f1 INT); CREATE TABLE t1(f1 INT);
EXPLAIN EXTENDED UPDATE t1 SET f2=1 ORDER BY f2; EXPLAIN EXTENDED UPDATE t1 SET f2=1 ORDER BY f2;
ERROR 42S22: Unknown column 'f2' in 'order clause' ERROR 42S22: Unknown column 'f2' in 'ORDER BY'
UPDATE t1 SET f2=1 ORDER BY f2; UPDATE t1 SET f2=1 ORDER BY f2;
ERROR 42S22: Unknown column 'f2' in 'order clause' ERROR 42S22: Unknown column 'f2' in 'ORDER BY'
DROP TABLE t1; DROP TABLE t1;
#62 #62
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);

View File

@ -67,7 +67,7 @@ SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
INSERT INTO t1 VALUES (1.2345, 2.3456); INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456); INSERT INTO t1 VALUES ('1.2345', 2.3456);
INSERT INTO t1 VALUES ("1.2345", 2.3456); INSERT INTO t1 VALUES ("1.2345", 2.3456);
ERROR 42S22: Unknown column '1.2345' in 'field list' ERROR 42S22: Unknown column '1.2345' in 'VALUES'
SET SQL_MODE=@OLD_SQL_MODE; SET SQL_MODE=@OLD_SQL_MODE;
/*M!999999\- enable the sandbox mode */ /*M!999999\- enable the sandbox mode */
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;

View File

@ -34,7 +34,7 @@ SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
INSERT INTO t1 VALUES (1.2345, 2.3456); INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456); INSERT INTO t1 VALUES ('1.2345', 2.3456);
INSERT INTO t1 VALUES ("1.2345", 2.3456); INSERT INTO t1 VALUES ("1.2345", 2.3456);
ERROR 42S22: Unknown column '1.2345' in 'field list' ERROR 42S22: Unknown column '1.2345' in 'VALUES'
SET SQL_MODE=@OLD_SQL_MODE; SET SQL_MODE=@OLD_SQL_MODE;
# Begin testing mysqldump output + restore # Begin testing mysqldump output + restore
# Create 'original table name - <table>_orig # Create 'original table name - <table>_orig

View File

@ -8,9 +8,9 @@ select otto from (select 1 as otto) as t1;
otto otto
1 1
select friedrich from (select 1 as otto) as t1; select friedrich from (select 1 as otto) as t1;
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed: ER_BAD_FIELD_ERROR (1054): Unknown column 'friedrich' in 'field list' mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed: ER_BAD_FIELD_ERROR (1054): Unknown column 'friedrich' in 'SELECT'
select friedrich from (select 1 as otto) as t1; select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list' ERROR 42S22: Unknown column 'friedrich' in 'SELECT'
select otto from (select 1 as otto) as t1; select otto from (select 1 as otto) as t1;
otto otto
1 1
@ -18,9 +18,9 @@ select otto from (select 1 as otto) as t1;
mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22... mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22...
mysqltest: At line 1: expecting a SQL-state (00000) from query 'remove_file MYSQLTEST_VARDIR/tmp/test_nonexistent.tmp' which cannot produce one... mysqltest: At line 1: expecting a SQL-state (00000) from query 'remove_file MYSQLTEST_VARDIR/tmp/test_nonexistent.tmp' which cannot produce one...
select friedrich from (select 1 as otto) as t1; select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list' ERROR 42S22: Unknown column 'friedrich' in 'SELECT'
select friedrich from (select 1 as otto) as t1; select friedrich from (select 1 as otto) as t1;
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22: 'Unknown column 'friedrich' in 'field list'', instead of 00000... mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22: 'Unknown column 'friedrich' in 'SELECT'', instead of 00000...
select otto from (select 1 as otto) as t1; select otto from (select 1 as otto) as t1;
otto otto
1 1

View File

@ -1,7 +1,7 @@
select error; select error;
mysqltest: At line 1: query 'select error' failed: ER_BAD_FIELD_ERROR (1054): Unknown column 'error' in 'field list' mysqltest: At line 1: query 'select error' failed: ER_BAD_FIELD_ERROR (1054): Unknown column 'error' in 'SELECT'
SELECT ERROR; SELECT ERROR;
mysqltest: At line 1: query 'SELECT ERROR' failed: ER_BAD_FIELD_ERROR (1054): Unknown column 'ERROR' in 'field list' mysqltest: At line 1: query 'SELECT ERROR' failed: ER_BAD_FIELD_ERROR (1054): Unknown column 'ERROR' in 'SELECT'
SELECT 2; SELECT 2;
2 2
2 2

View File

@ -7,7 +7,7 @@ create table t (a int primary key, b blob default '');
select a, (2*a) AS a from t group by a; select a, (2*a) AS a from t group by a;
a a a a
Warnings: Warnings:
Warning 1052 Column 'a' in group statement is ambiguous Warning 1052 Column 'a' in GROUP BY is ambiguous
drop table t; drop table t;
select 1 + "2 a"; select 1 + "2 a";
1 + "2 a" 1 + "2 a"
@ -18,8 +18,8 @@ create table t (a int primary key, b blob default '');
select a, (2*a) AS a from t group by a; select a, (2*a) AS a from t group by a;
a a a a
Warnings: Warnings:
Warning 1052 Column 'a' in group statement is ambiguous Warning 1052 Column 'a' in GROUP BY is ambiguous
Warning 1052 Column 'a' in group statement is ambiguous Warning 1052 Column 'a' in GROUP BY is ambiguous
drop table t; drop table t;
select 1 + "2 a"; select 1 + "2 a";
1 + "2 a" 1 + "2 a"
@ -30,5 +30,5 @@ create table t (a int primary key, b blob default '');
select a, (2*a) AS a from t group by a; select a, (2*a) AS a from t group by a;
a a a a
Warnings: Warnings:
Warning 1052 Column 'a' in group statement is ambiguous Warning 1052 Column 'a' in GROUP BY is ambiguous
drop table t; drop table t;

View File

@ -2156,7 +2156,7 @@ SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA',
Kundentyp kategorie Kundentyp kategorie
Privat (Private Nutzung) Mobilfunk Privat (Private Nutzung) Mobilfunk
Warnings: Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous Warning 1052 Column 'kundentyp' in GROUP BY is ambiguous
drop table t1; drop table t1;
connection default; connection default;
disconnect pipe_con; disconnect pipe_con;

View File

@ -796,18 +796,18 @@ col1 col t2_col
2 2 2 2 2 2
3 3 1 3 3 1
select col1 as col, col from t1 order by col; select col1 as col, col from t1 order by col;
ERROR 23000: Column 'col' in order clause is ambiguous ERROR 23000: Column 'col' in ORDER BY is ambiguous
select t1.col as c1, t2.col as c2 from t1, t2 where t1.col1=t2.col2 select t1.col as c1, t2.col as c2 from t1, t2 where t1.col1=t2.col2
order by col; order by col;
ERROR 23000: Column 'col' in order clause is ambiguous ERROR 23000: Column 'col' in ORDER BY is ambiguous
select t1.col as c1, t2.col as c2 from t1, t2 where t1.col1=t2.col2 select t1.col as c1, t2.col as c2 from t1, t2 where t1.col1=t2.col2
order by col; order by col;
ERROR 23000: Column 'col' in order clause is ambiguous ERROR 23000: Column 'col' in ORDER BY is ambiguous
select col1 from t1, t2 where t1.col1=t2.col2 order by col; select col1 from t1, t2 where t1.col1=t2.col2 order by col;
ERROR 23000: Column 'col' in order clause is ambiguous ERROR 23000: Column 'col' in ORDER BY is ambiguous
select t1.col as t1_col, t2.col2 from t1, t2 where t1.col1=t2.col2 select t1.col as t1_col, t2.col2 from t1, t2 where t1.col1=t2.col2
order by col; order by col;
ERROR 23000: Column 'col' in order clause is ambiguous ERROR 23000: Column 'col' in ORDER BY is ambiguous
select t1.col as t1_col, t2.col from t1, t2 where t1.col1=t2.col2 select t1.col as t1_col, t2.col from t1, t2 where t1.col1=t2.col2
order by col; order by col;
t1_col col t1_col col
@ -958,45 +958,45 @@ num
2 2
3 3
SELECT a + 1 AS num, num + 1 FROM t1; SELECT a + 1 AS num, num + 1 FROM t1;
ERROR 42S22: Unknown column 'num' in 'field list' ERROR 42S22: Unknown column 'num' in 'SELECT'
SELECT a + 1 AS num, (select num + 2 FROM t1 LIMIT 1) FROM t1; SELECT a + 1 AS num, (select num + 2 FROM t1 LIMIT 1) FROM t1;
num (select num + 2 FROM t1 LIMIT 1) num (select num + 2 FROM t1 LIMIT 1)
2 4 2 4
3 5 3 5
SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a; SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a;
ERROR 42S22: Unknown column 'num' in 'on clause' ERROR 42S22: Unknown column 'num' in 'ON'
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE bug25126 ( CREATE TABLE bug25126 (
val int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY val int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
); );
UPDATE bug25126 SET MissingCol = MissingCol; UPDATE bug25126 SET MissingCol = MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'field list' ERROR 42S22: Unknown column 'MissingCol' in 'SET'
UPDATE bug25126 SET val = val ORDER BY MissingCol; UPDATE bug25126 SET val = val ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause' ERROR 42S22: Unknown column 'MissingCol' in 'ORDER BY'
UPDATE bug25126 SET val = val ORDER BY val; UPDATE bug25126 SET val = val ORDER BY val;
UPDATE bug25126 SET val = 1 ORDER BY val; UPDATE bug25126 SET val = 1 ORDER BY val;
UPDATE bug25126 SET val = 1 ORDER BY MissingCol; UPDATE bug25126 SET val = 1 ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause' ERROR 42S22: Unknown column 'MissingCol' in 'ORDER BY'
UPDATE bug25126 SET val = 1 ORDER BY val, MissingCol; UPDATE bug25126 SET val = 1 ORDER BY val, MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause' ERROR 42S22: Unknown column 'MissingCol' in 'ORDER BY'
UPDATE bug25126 SET val = MissingCol ORDER BY MissingCol; UPDATE bug25126 SET val = MissingCol ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause' ERROR 42S22: Unknown column 'MissingCol' in 'ORDER BY'
UPDATE bug25126 SET MissingCol = 1 ORDER BY val, MissingCol; UPDATE bug25126 SET MissingCol = 1 ORDER BY val, MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause' ERROR 42S22: Unknown column 'MissingCol' in 'ORDER BY'
UPDATE bug25126 SET MissingCol = 1 ORDER BY MissingCol; UPDATE bug25126 SET MissingCol = 1 ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause' ERROR 42S22: Unknown column 'MissingCol' in 'ORDER BY'
UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol; UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause' ERROR 42S22: Unknown column 'MissingCol' in 'ORDER BY'
UPDATE bug25126 SET MissingCol = MissingCol ORDER BY MissingCol; UPDATE bug25126 SET MissingCol = MissingCol ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause' ERROR 42S22: Unknown column 'MissingCol' in 'ORDER BY'
DROP TABLE bug25126; DROP TABLE bug25126;
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
SELECT p.a AS val, q.a AS val1 FROM t1 p, t1 q ORDER BY val > 1; SELECT p.a AS val, q.a AS val1 FROM t1 p, t1 q ORDER BY val > 1;
val val1 val val1
SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val; SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val;
ERROR 23000: Column 'val' in order clause is ambiguous ERROR 23000: Column 'val' in ORDER BY is ambiguous
SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1; SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
ERROR 23000: Column 'val' in order clause is ambiguous ERROR 23000: Column 'val' in ORDER BY is ambiguous
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (3), (2), (4), (1); INSERT INTO t1 VALUES (3), (2), (4), (1);

View File

@ -2231,11 +2231,11 @@ drop table t1;
# MDEV-19682 sql_mode="oracle" does not support sysdate # MDEV-19682 sql_mode="oracle" does not support sysdate
# #
SELECT sysdate LIKE '____-__-__ __:__:__'; SELECT sysdate LIKE '____-__-__ __:__:__';
ERROR 42S22: Unknown column 'sysdate' in 'field list' ERROR 42S22: Unknown column 'sysdate' in 'SELECT'
SELECT sysdate = sysdate(); SELECT sysdate = sysdate();
ERROR 42S22: Unknown column 'sysdate' in 'field list' ERROR 42S22: Unknown column 'sysdate' in 'SELECT'
SELECT sysdate = sysdate(0); SELECT sysdate = sysdate(0);
ERROR 42S22: Unknown column 'sysdate' in 'field list' ERROR 42S22: Unknown column 'sysdate' in 'SELECT'
CREATE DATABASE sysdate; CREATE DATABASE sysdate;
DROP DATABASE sysdate; DROP DATABASE sysdate;
CREATE TABLE sysdate (a INT); CREATE TABLE sysdate (a INT);

View File

@ -2018,7 +2018,7 @@ PARTITION BY RANGE (t2.b) (
PARTITION p1 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20) PARTITION p2 VALUES LESS THAN (20)
) select * from t2; ) select * from t2;
ERROR 42S22: Unknown column 't2.b' in 'partition function' ERROR 42S22: Unknown column 't2.b' in 'PARTITION BY'
create table t1 (a int) create table t1 (a int)
PARTITION BY RANGE (b) ( PARTITION BY RANGE (b) (
PARTITION p1 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (10),

View File

@ -572,7 +572,7 @@ create table t1 (a char(6))
partition by range columns(a) partition by range columns(a)
(partition p0 values less than (H23456), (partition p0 values less than (H23456),
partition p1 values less than (M23456)); partition p1 values less than (M23456));
ERROR 42S22: Unknown column 'H23456' in 'field list' ERROR 42S22: Unknown column 'H23456' in 'PARTITION BY'
create table t1 (a char(6)) create table t1 (a char(6))
partition by range columns(a) partition by range columns(a)
(partition p0 values less than (23456), (partition p0 values less than (23456),

View File

@ -934,7 +934,7 @@ partitions 3
(partition x1 tablespace ts1, (partition x1 tablespace ts1,
partition x2 tablespace ts2, partition x2 tablespace ts2,
partition x3 tablespace ts3); partition x3 tablespace ts3);
ERROR 42S22: Unknown column 'd' in 'partition function' ERROR 42S22: Unknown column 'd' in 'PARTITION BY'
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
@ -1156,7 +1156,7 @@ partition by range (a)
subpartition by hash (a+d) subpartition by hash (a+d)
(partition x1 values less than (1) (subpartition x11, subpartition x12), (partition x1 values less than (1) (subpartition x11, subpartition x12),
partition x2 values less than (2) (subpartition x21, subpartition x22)); partition x2 values less than (2) (subpartition x21, subpartition x22));
ERROR 42S22: Unknown column 'd' in 'partition function' ERROR 42S22: Unknown column 'd' in 'PARTITION BY'
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
@ -1176,7 +1176,7 @@ partition by range (a+d)
partitions 2 partitions 2
(partition x1 values less than (4) tablespace ts1, (partition x1 values less than (4) tablespace ts1,
partition x2 values less than (8) tablespace ts2); partition x2 values less than (8) tablespace ts2);
ERROR 42S22: Unknown column 'd' in 'partition function' ERROR 42S22: Unknown column 'd' in 'PARTITION BY'
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
@ -1375,7 +1375,7 @@ partition by list (a+d)
partitions 2 partitions 2
(partition x1 values in (4) tablespace ts1, (partition x1 values in (4) tablespace ts1,
partition x2 values in (8) tablespace ts2); partition x2 values in (8) tablespace ts2);
ERROR 42S22: Unknown column 'd' in 'partition function' ERROR 42S22: Unknown column 'd' in 'PARTITION BY'
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
@ -1440,7 +1440,7 @@ partition x2 values in (5))' at line 8
CREATE TABLE t1 (a int) CREATE TABLE t1 (a int)
PARTITION BY RANGE (a) PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (x1)); (PARTITION p0 VALUES LESS THAN (x1));
ERROR 42S22: Unknown column 'x1' in 'partition function' ERROR 42S22: Unknown column 'x1' in 'PARTITION BY'
CREATE TABLE t1(a int) CREATE TABLE t1(a int)
PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN(5)); PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN(5));
insert into t1 values (10); insert into t1 values (10);

View File

@ -166,6 +166,6 @@ alter table t1 check partition all for upgrade;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
alter table t1 order by nonexistent; alter table t1 order by nonexistent;
ERROR 42S22: Unknown column 'nonexistent' in 'order clause' ERROR 42S22: Unknown column 'nonexistent' in 'ORDER BY'
drop table t1; drop table t1;
# End of 10.5 tests # End of 10.5 tests

View File

@ -2156,7 +2156,7 @@ SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA',
Kundentyp kategorie Kundentyp kategorie
Privat (Private Nutzung) Mobilfunk Privat (Private Nutzung) Mobilfunk
Warnings: Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous Warning 1052 Column 'kundentyp' in GROUP BY is ambiguous
drop table t1; drop table t1;
SET optimizer_switch=default; SET optimizer_switch=default;
connection default; connection default;

View File

@ -1737,15 +1737,15 @@ create table t1 (id int primary key auto_increment, value varchar(10));
insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD'); insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD');
prepare stmt from "insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP'"; prepare stmt from "insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP'";
execute stmt; execute stmt;
ERROR 42S22: Unknown column 'v' in 'field list' ERROR 42S22: Unknown column 'v' in 'UPDATE'
execute stmt; execute stmt;
ERROR 42S22: Unknown column 'v' in 'field list' ERROR 42S22: Unknown column 'v' in 'UPDATE'
deallocate prepare stmt; deallocate prepare stmt;
prepare stmt from "insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP'"; prepare stmt from "insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP'";
execute stmt; execute stmt;
ERROR 42S22: Unknown column 'y.value' in 'field list' ERROR 42S22: Unknown column 'y.value' in 'UPDATE'
execute stmt; execute stmt;
ERROR 42S22: Unknown column 'y.value' in 'field list' ERROR 42S22: Unknown column 'y.value' in 'UPDATE'
deallocate prepare stmt; deallocate prepare stmt;
drop tables t1; drop tables t1;
prepare stmt from "create table t1 select ?"; prepare stmt from "create table t1 select ?";
@ -4933,9 +4933,9 @@ ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
PREPARE stmt FROM (SELECT 'SELECT 1'); PREPARE stmt FROM (SELECT 'SELECT 1');
ERROR 42000: PREPARE..FROM does not support subqueries or stored functions ERROR 42000: PREPARE..FROM does not support subqueries or stored functions
EXECUTE IMMEDIATE a; EXECUTE IMMEDIATE a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'EXECUTE IMMEDIATE'
PREPARE stmt FROM a; PREPARE stmt FROM a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'PREPARE..FROM'
EXECUTE IMMEDIATE NULL; EXECUTE IMMEDIATE NULL;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1
PREPARE stmt FROM NULL; PREPARE stmt FROM NULL;
@ -4955,9 +4955,9 @@ ERROR 21000: Operand should contain 1 column(s)
EXECUTE IMMEDIATE MAX('SELECT 1 AS c'); EXECUTE IMMEDIATE MAX('SELECT 1 AS c');
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
EXECUTE IMMEDIATE DEFAULT(a); EXECUTE IMMEDIATE DEFAULT(a);
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'EXECUTE IMMEDIATE'
EXECUTE IMMEDIATE VALUE(a); EXECUTE IMMEDIATE VALUE(a);
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'EXECUTE IMMEDIATE'
CREATE FUNCTION f1() RETURNS VARCHAR(64) RETURN 't1'; CREATE FUNCTION f1() RETURNS VARCHAR(64) RETURN 't1';
EXECUTE IMMEDIATE f1(); EXECUTE IMMEDIATE f1();
ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions

View File

@ -91,11 +91,11 @@ prepare stmt1 from @arg01;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1
prepare stmt1 from ' select * from t1 where a <= 2 ' ; prepare stmt1 from ' select * from t1 where a <= 2 ' ;
prepare stmt1 from ' select * from t1 where x <= 2 ' ; prepare stmt1 from ' select * from t1 where x <= 2 ' ;
ERROR 42S22: Unknown column 'x' in 'where clause' ERROR 42S22: Unknown column 'x' in 'WHERE'
prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ; prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ;
ERROR 42S22: Unknown column 'x' in 'field list' ERROR 42S22: Unknown column 'x' in 'INSERT INTO'
prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ; prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ;
ERROR 42S22: Unknown column 'x' in 'field list' ERROR 42S22: Unknown column 'x' in 'INSERT INTO'
drop table if exists not_exist ; drop table if exists not_exist ;
prepare stmt1 from ' select * from not_exist where a <= 2 ' ; prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
ERROR 42S02: Table 'test.not_exist' doesn't exist ERROR 42S02: Table 'test.not_exist' doesn't exist

View File

@ -440,7 +440,7 @@ a b
4 four 4 four
set @arg00=0 ; set @arg00=0 ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause' ERROR 42S22: Unknown column '?' in 'ORDER BY'
set @arg00=1; set @arg00=1;
prepare stmt1 from ' select a,b from t1 order by a prepare stmt1 from ' select a,b from t1 order by a
limit 1 '; limit 1 ';

View File

@ -440,7 +440,7 @@ a b
4 four 4 four
set @arg00=0 ; set @arg00=0 ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause' ERROR 42S22: Unknown column '?' in 'ORDER BY'
set @arg00=1; set @arg00=1;
prepare stmt1 from ' select a,b from t1 order by a prepare stmt1 from ' select a,b from t1 order by a
limit 1 '; limit 1 ';

View File

@ -441,7 +441,7 @@ a b
4 four 4 four
set @arg00=0 ; set @arg00=0 ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause' ERROR 42S22: Unknown column '?' in 'ORDER BY'
set @arg00=1; set @arg00=1;
prepare stmt1 from ' select a,b from t1 order by a prepare stmt1 from ' select a,b from t1 order by a
limit 1 '; limit 1 ';

View File

@ -484,7 +484,7 @@ a b
4 four 4 four
set @arg00=0 ; set @arg00=0 ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause' ERROR 42S22: Unknown column '?' in 'ORDER BY'
set @arg00=1; set @arg00=1;
prepare stmt1 from ' select a,b from t1 order by a prepare stmt1 from ' select a,b from t1 order by a
limit 1 '; limit 1 ';
@ -3852,7 +3852,7 @@ a b
4 four 4 four
set @arg00=0 ; set @arg00=0 ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause' ERROR 42S22: Unknown column '?' in 'ORDER BY'
set @arg00=1; set @arg00=1;
prepare stmt1 from ' select a,b from t1 order by a prepare stmt1 from ' select a,b from t1 order by a
limit 1 '; limit 1 ';

View File

@ -165,7 +165,7 @@ call p_verify_reprepare_count(1);
SUCCESS SUCCESS
execute stmt7; execute stmt7;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'INSERT INTO'
call p_verify_reprepare_count(1); call p_verify_reprepare_count(1);
SUCCESS SUCCESS
@ -185,17 +185,17 @@ call p_verify_reprepare_count(1);
SUCCESS SUCCESS
execute stmt3; execute stmt3;
ERROR 42S22: Unknown column 'b' in 'where clause' ERROR 42S22: Unknown column 'b' in 'WHERE'
call p_verify_reprepare_count(1); call p_verify_reprepare_count(1);
SUCCESS SUCCESS
execute stmt2; execute stmt2;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
call p_verify_reprepare_count(1); call p_verify_reprepare_count(1);
SUCCESS SUCCESS
execute stmt1; execute stmt1;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
call p_verify_reprepare_count(1); call p_verify_reprepare_count(1);
SUCCESS SUCCESS
@ -205,7 +205,7 @@ call p_verify_reprepare_count(1);
ERROR ERROR
Expected: 1, actual: 0 Expected: 1, actual: 0
execute stmt7; execute stmt7;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'INSERT INTO'
call p_verify_reprepare_count(1); call p_verify_reprepare_count(1);
SUCCESS SUCCESS
@ -225,17 +225,17 @@ call p_verify_reprepare_count(1);
SUCCESS SUCCESS
execute stmt3; execute stmt3;
ERROR 42S22: Unknown column 'b' in 'where clause' ERROR 42S22: Unknown column 'b' in 'WHERE'
call p_verify_reprepare_count(1); call p_verify_reprepare_count(1);
SUCCESS SUCCESS
execute stmt2; execute stmt2;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
call p_verify_reprepare_count(1); call p_verify_reprepare_count(1);
SUCCESS SUCCESS
execute stmt1; execute stmt1;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
call p_verify_reprepare_count(1); call p_verify_reprepare_count(1);
SUCCESS SUCCESS

View File

@ -205,7 +205,7 @@ CREATE TABLE t2 LIKE t1;
SET AUTOCOMMIT=OFF; SET AUTOCOMMIT=OFF;
CREATE VIEW t1_view AS SELECT c1 FROM t1 NATURAL JOIN t2 ; CREATE VIEW t1_view AS SELECT c1 FROM t1 NATURAL JOIN t2 ;
INSERT INTO t1_view (c1, c2) SELECT c1, c2 FROM t1; INSERT INTO t1_view (c1, c2) SELECT c1, c2 FROM t1;
ERROR 42S22: Unknown column 'c2' in 'field list' ERROR 42S22: Unknown column 'c2' in 'INSERT INTO'
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
DROP VIEW t1_view; DROP VIEW t1_view;

View File

@ -175,7 +175,7 @@ REPLACE INTO t1 VALUES(1,'a'),(2,'b'),(3,'c');
# SIMLPE REPLACE STATEMENT # SIMLPE REPLACE STATEMENT
# #
REPLACE INTO t2(id2,val2) VALUES(1,'a') RETURNING id1; REPLACE INTO t2(id2,val2) VALUES(1,'a') RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
REPLACE INTO t2(id2,val2) values(2,'b') RETURNING SUM(id2); REPLACE INTO t2(id2,val2) values(2,'b') RETURNING SUM(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
REPLACE INTO t2(id2,val2) VALUES(3,'c') RETURNING (SELECT id1 FROM t1); REPLACE INTO t2(id2,val2) VALUES(3,'c') RETURNING (SELECT id1 FROM t1);
@ -197,7 +197,7 @@ ERROR 42S02: Unknown table 'test.t1'
# Multiple rows in single insert statement # Multiple rows in single insert statement
# #
REPLACE INTO t2 VALUES(1,'a'),(2,'b') RETURNING id1; REPLACE INTO t2 VALUES(1,'a'),(2,'b') RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
REPLACE INTO t2 VALUES(3,'c'),(4,'d') RETURNING MAX(id2); REPLACE INTO t2 VALUES(3,'c'),(4,'d') RETURNING MAX(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
REPLACE INTO t2 VALUES(5,'c'),(6,'f') RETURNING (SELECT id1 FROM t1); REPLACE INTO t2 VALUES(5,'c'),(6,'f') RETURNING (SELECT id1 FROM t1);
@ -220,7 +220,7 @@ ERROR 42S02: Unknown table 'test.t1'
# REPLACE ... SET # REPLACE ... SET
# #
REPLACE INTO t2 SET id2=1, val2='a' RETURNING id1; REPLACE INTO t2 SET id2=1, val2='a' RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
REPLACE INTO t2 SET id2=2, val2='b' RETURNING COUNT(id2); REPLACE INTO t2 SET id2=2, val2='b' RETURNING COUNT(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
REPLACE INTO t2 SET id2=3, val2='c' RETURNING (SELECT id1 FROM t1); REPLACE INTO t2 SET id2=3, val2='c' RETURNING (SELECT id1 FROM t1);
@ -242,7 +242,7 @@ ERROR 42S02: Unknown table 'test.t1'
# REPLACE...SELECT # REPLACE...SELECT
# #
REPLACE INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=1 RETURNING id1; REPLACE INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=1 RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
REPLACE INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=2 RETURNING MAX(id2); REPLACE INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=2 RETURNING MAX(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
REPLACE INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=2 RETURNING (SELECT REPLACE INTO t2(id2, val2) SELECT * FROM t1 WHERE id1=2 RETURNING (SELECT

View File

@ -5,7 +5,7 @@ INSERT INTO t1 VALUES(1, 'a'), (2, 'b'), (3, 'c');
# SIMLPE REPLACE STATEMENT # SIMLPE REPLACE STATEMENT
# #
REPLACE INTO t2(id2, val2) VALUES(1, 'a') RETURNING id1; REPLACE INTO t2(id2, val2) VALUES(1, 'a') RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
REPLACE INTO t2(id2, val2) values(2, 'b') RETURNING SUM(id2); REPLACE INTO t2(id2, val2) values(2, 'b') RETURNING SUM(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
REPLACE INTO t2(id2, val2) VALUES(3, 'c') RETURNING(SELECT id1 FROM t1); REPLACE INTO t2(id2, val2) VALUES(3, 'c') RETURNING(SELECT id1 FROM t1);
@ -20,7 +20,7 @@ ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as
# Multiple rows in single replace statement # Multiple rows in single replace statement
# #
REPLACE INTO t2 VALUES(1, 'a'), (2, 'b') RETURNING id1; REPLACE INTO t2 VALUES(1, 'a'), (2, 'b') RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
REPLACE INTO t2 VALUES(3, 'c'), (4, 'd') RETURNING MAX(id2); REPLACE INTO t2 VALUES(3, 'c'), (4, 'd') RETURNING MAX(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
REPLACE INTO t2 VALUES(5, 'c'), (6, 'f') RETURNING(SELECT id1 FROM t1); REPLACE INTO t2 VALUES(5, 'c'), (6, 'f') RETURNING(SELECT id1 FROM t1);
@ -35,7 +35,7 @@ ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as
# REPLACE ... SET # REPLACE ... SET
# #
REPLACE INTO t2 SET id2 = 1, val2 = 'a' RETURNING id1; REPLACE INTO t2 SET id2 = 1, val2 = 'a' RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
REPLACE INTO t2 SET id2 = 2, val2 = 'b' RETURNING COUNT(id2); REPLACE INTO t2 SET id2 = 2, val2 = 'b' RETURNING COUNT(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
REPLACE INTO t2 SET id2 = 3, val2 = 'c' RETURNING(SELECT id1 FROM t1); REPLACE INTO t2 SET id2 = 3, val2 = 'c' RETURNING(SELECT id1 FROM t1);
@ -50,7 +50,7 @@ ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as
# REPLACE...SELECT # REPLACE...SELECT
# #
REPLACE INTO t2(id2, val2) SELECT* FROM t1 WHERE id1 = 1 RETURNING id1; REPLACE INTO t2(id2, val2) SELECT* FROM t1 WHERE id1 = 1 RETURNING id1;
ERROR 42S22: Unknown column 'id1' in 'field list' ERROR 42S22: Unknown column 'id1' in 'RETURNING'
REPLACE INTO t2(id2, val2) SELECT* FROM t1 WHERE id1 = 2 RETURNING MAX(id2); REPLACE INTO t2(id2, val2) SELECT* FROM t1 WHERE id1 = 2 RETURNING MAX(id2);
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
REPLACE INTO t2(id2, val2) SELECT* FROM t1 WHERE id1 = 2 RETURNING(SELECT id1 REPLACE INTO t2(id2, val2) SELECT* FROM t1 WHERE id1 = 2 RETURNING(SELECT id1

View File

@ -2098,7 +2098,7 @@ DO benchmark(100,1+1),1,1;
do default; do default;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
do foobar; do foobar;
ERROR 42S22: Unknown column 'foobar' in 'field list' ERROR 42S22: Unknown column 'foobar' in 'DO'
CREATE TABLE t1 ( CREATE TABLE t1 (
id mediumint(8) unsigned NOT NULL auto_increment, id mediumint(8) unsigned NOT NULL auto_increment,
pseudo varchar(35) NOT NULL default '', pseudo varchar(35) NOT NULL default '',
@ -3090,13 +3090,13 @@ INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t2 VALUES (2); INSERT INTO t2 VALUES (2);
INSERT INTO t3 VALUES (3); INSERT INTO t3 VALUES (3);
SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id); SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.notacolumn=t1.id) LEFT JOIN t3 USING (id); SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.notacolumn=t1.id) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
SELECT id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id); SELECT id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id); SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (a int(10),b int(10)); create table t1 (a int(10),b int(10));
create table t2 (a int(10),b int(10)); create table t2 (a int(10),b int(10));
@ -3121,7 +3121,7 @@ select * from t1 join t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
a c b b a a c b b a
1 1 1 1 1 1 1 1 1 1
select * from t1, t2 join t3 on (t2.b = t3.b and t1.a = t3.a); select * from t1, t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
ERROR 42S22: Unknown column 't1.a' in 'on clause' ERROR 42S22: Unknown column 't1.a' in 'ON'
select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c); select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c);
a c b b a c a c b b a c
1 1 1 1 1 1 1 1 1 1 1 1
@ -5597,7 +5597,7 @@ drop table t1;
CREATE TABLE t1 (a INT, b INT); CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,10),(2,20); INSERT INTO t1 VALUES (1,10),(2,20);
SELECT b, GROUP_CONCAT(b ORDER BY 2), MIN(a) AS f FROM t1 GROUP BY b ORDER BY f; SELECT b, GROUP_CONCAT(b ORDER BY 2), MIN(a) AS f FROM t1 GROUP BY b ORDER BY f;
ERROR 42S22: Unknown column '2' in 'order clause' ERROR 42S22: Unknown column '2' in 'ORDER BY'
DROP TABLE t1; DROP TABLE t1;
# #
# Bug MDEV-24560 SIGSEGV in st_join_table::cleanup + server and client # Bug MDEV-24560 SIGSEGV in st_join_table::cleanup + server and client

View File

@ -2109,7 +2109,7 @@ DO benchmark(100,1+1),1,1;
do default; do default;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
do foobar; do foobar;
ERROR 42S22: Unknown column 'foobar' in 'field list' ERROR 42S22: Unknown column 'foobar' in 'DO'
CREATE TABLE t1 ( CREATE TABLE t1 (
id mediumint(8) unsigned NOT NULL auto_increment, id mediumint(8) unsigned NOT NULL auto_increment,
pseudo varchar(35) NOT NULL default '', pseudo varchar(35) NOT NULL default '',
@ -3101,13 +3101,13 @@ INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t2 VALUES (2); INSERT INTO t2 VALUES (2);
INSERT INTO t3 VALUES (3); INSERT INTO t3 VALUES (3);
SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id); SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.notacolumn=t1.id) LEFT JOIN t3 USING (id); SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.notacolumn=t1.id) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
SELECT id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id); SELECT id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id); SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (a int(10),b int(10)); create table t1 (a int(10),b int(10));
create table t2 (a int(10),b int(10)); create table t2 (a int(10),b int(10));
@ -3132,7 +3132,7 @@ select * from t1 join t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
a c b b a a c b b a
1 1 1 1 1 1 1 1 1 1
select * from t1, t2 join t3 on (t2.b = t3.b and t1.a = t3.a); select * from t1, t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
ERROR 42S22: Unknown column 't1.a' in 'on clause' ERROR 42S22: Unknown column 't1.a' in 'ON'
select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c); select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c);
a c b b a c a c b b a c
1 1 1 1 1 1 1 1 1 1 1 1
@ -5608,7 +5608,7 @@ drop table t1;
CREATE TABLE t1 (a INT, b INT); CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,10),(2,20); INSERT INTO t1 VALUES (1,10),(2,20);
SELECT b, GROUP_CONCAT(b ORDER BY 2), MIN(a) AS f FROM t1 GROUP BY b ORDER BY f; SELECT b, GROUP_CONCAT(b ORDER BY 2), MIN(a) AS f FROM t1 GROUP BY b ORDER BY f;
ERROR 42S22: Unknown column '2' in 'order clause' ERROR 42S22: Unknown column '2' in 'ORDER BY'
DROP TABLE t1; DROP TABLE t1;
# #
# Bug MDEV-24560 SIGSEGV in st_join_table::cleanup + server and client # Bug MDEV-24560 SIGSEGV in st_join_table::cleanup + server and client

View File

@ -2098,7 +2098,7 @@ DO benchmark(100,1+1),1,1;
do default; do default;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
do foobar; do foobar;
ERROR 42S22: Unknown column 'foobar' in 'field list' ERROR 42S22: Unknown column 'foobar' in 'DO'
CREATE TABLE t1 ( CREATE TABLE t1 (
id mediumint(8) unsigned NOT NULL auto_increment, id mediumint(8) unsigned NOT NULL auto_increment,
pseudo varchar(35) NOT NULL default '', pseudo varchar(35) NOT NULL default '',
@ -3090,13 +3090,13 @@ INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t2 VALUES (2); INSERT INTO t2 VALUES (2);
INSERT INTO t3 VALUES (3); INSERT INTO t3 VALUES (3);
SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id); SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.notacolumn=t1.id) LEFT JOIN t3 USING (id); SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.notacolumn=t1.id) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
SELECT id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id); SELECT id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id); SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous ERROR 23000: Column 'id' in FROM is ambiguous
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (a int(10),b int(10)); create table t1 (a int(10),b int(10));
create table t2 (a int(10),b int(10)); create table t2 (a int(10),b int(10));
@ -3121,7 +3121,7 @@ select * from t1 join t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
a c b b a a c b b a
1 1 1 1 1 1 1 1 1 1
select * from t1, t2 join t3 on (t2.b = t3.b and t1.a = t3.a); select * from t1, t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
ERROR 42S22: Unknown column 't1.a' in 'on clause' ERROR 42S22: Unknown column 't1.a' in 'ON'
select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c); select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c);
a c b b a c a c b b a c
1 1 1 1 1 1 1 1 1 1 1 1
@ -5597,7 +5597,7 @@ drop table t1;
CREATE TABLE t1 (a INT, b INT); CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,10),(2,20); INSERT INTO t1 VALUES (1,10),(2,20);
SELECT b, GROUP_CONCAT(b ORDER BY 2), MIN(a) AS f FROM t1 GROUP BY b ORDER BY f; SELECT b, GROUP_CONCAT(b ORDER BY 2), MIN(a) AS f FROM t1 GROUP BY b ORDER BY f;
ERROR 42S22: Unknown column '2' in 'order clause' ERROR 42S22: Unknown column '2' in 'ORDER BY'
DROP TABLE t1; DROP TABLE t1;
# #
# Bug MDEV-24560 SIGSEGV in st_join_table::cleanup + server and client # Bug MDEV-24560 SIGSEGV in st_join_table::cleanup + server and client

View File

@ -228,9 +228,9 @@ prepare stmt from "select 'dynamic sql:', @a, a";
execute stmt; execute stmt;
end| end|
call p1()| call p1()|
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
call p1()| call p1()|
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
set sql_mode= DEFAULT| set sql_mode= DEFAULT|
drop procedure p1| drop procedure p1|
create procedure p1() create procedure p1()

View File

@ -1,4 +1,3 @@
drop table if exists t1, t2;
SELECT * FROM mysql.proc INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/proc.txt'; SELECT * FROM mysql.proc INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/proc.txt';
Warnings: Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
@ -9,7 +8,6 @@ create procedure syntaxerror(t int)|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
create procedure syntaxerror(t int)| create procedure syntaxerror(t int)|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
drop table if exists t3|
create table t3 ( x int )| create table t3 ( x int )|
insert into t3 values (2), (3)| insert into t3 values (2), (3)|
create procedure bad_into(out param int) create procedure bad_into(out param int)
@ -166,7 +164,6 @@ open cc;
close c; close c;
end| end|
ERROR 42000: Undefined CURSOR: cc ERROR 42000: Undefined CURSOR: cc
drop table if exists t1|
create table t1 (val int)| create table t1 (val int)|
create procedure p() create procedure p()
begin begin
@ -191,7 +188,6 @@ drop procedure p|
alter procedure bar3 sql security invoker| alter procedure bar3 sql security invoker|
ERROR 42000: PROCEDURE test.bar3 does not exist ERROR 42000: PROCEDURE test.bar3 does not exist
drop table t1| drop table t1|
drop table if exists t1|
create table t1 (val int, x float)| create table t1 (val int, x float)|
insert into t1 values (42, 3.1), (19, 1.2)| insert into t1 values (42, 3.1), (19, 1.2)|
create procedure p() create procedure p()
@ -276,7 +272,6 @@ declare continue handler for sqlstate '42S99' set x = 1;
declare c cursor for select * from t1; declare c cursor for select * from t1;
end| end|
ERROR 42000: Cursor declaration after handler declaration ERROR 42000: Cursor declaration after handler declaration
drop procedure if exists p|
create procedure p(in x int, inout y int, out z int) create procedure p(in x int, inout y int, out z int)
begin begin
set y = x+y; set y = x+y;
@ -307,7 +302,6 @@ lock tables t1 read, mysql.proc read|
unlock tables| unlock tables|
lock tables mysql.proc write| lock tables mysql.proc write|
unlock tables| unlock tables|
drop function if exists f1|
create function f1(i int) returns int create function f1(i int) returns int
begin begin
insert into t1 (val) values (i); insert into t1 (val) values (i);
@ -344,16 +338,15 @@ open c;
close c; close c;
end| end|
call bug1965()| call bug1965()|
ERROR 42S22: Unknown column 'valname' in 'order clause' ERROR 42S22: Unknown column 'valname' in 'ORDER BY'
drop procedure bug1965| drop procedure bug1965|
select 1 into a| select 1 into a|
ERROR 42000: Undeclared variable: a ERROR 42000: Undeclared variable: a
drop table if exists t3|
create table t3 (column_1_0 int)| create table t3 (column_1_0 int)|
create procedure bug1653() create procedure bug1653()
update t3 set column_1 = 0| update t3 set column_1 = 0|
call bug1653()| call bug1653()|
ERROR 42S22: Unknown column 'column_1' in 'field list' ERROR 42S22: Unknown column 'column_1' in 'SET'
drop table t3| drop table t3|
create table t3 (column_1 int)| create table t3 (column_1 int)|
call bug1653()| call bug1653()|
@ -375,7 +368,7 @@ update t1 set v = 42;
end| end|
insert into t1 values (666, 51.3)| insert into t1 values (666, 51.3)|
call bug2272()| call bug2272()|
ERROR 42S22: Unknown column 'v' in 'field list' ERROR 42S22: Unknown column 'v' in 'SET'
truncate table t1| truncate table t1|
drop procedure bug2272| drop procedure bug2272|
create procedure bug2329_1() create procedure bug2329_1()
@ -389,9 +382,9 @@ declare v int;
replace t1 set v = 5; replace t1 set v = 5;
end| end|
call bug2329_1()| call bug2329_1()|
ERROR 42S22: Unknown column 'v' in 'field list' ERROR 42S22: Unknown column 'v' in 'INSERT INTO'
call bug2329_2()| call bug2329_2()|
ERROR 42S22: Unknown column 'v' in 'field list' ERROR 42S22: Unknown column 'v' in 'INSERT INTO'
drop procedure bug2329_1| drop procedure bug2329_1|
drop procedure bug2329_2| drop procedure bug2329_2|
create function bug3287() returns int create function bug3287() returns int
@ -415,7 +408,6 @@ end case|
call bug3287(2)| call bug3287(2)|
ERROR 20000: Case not found for CASE statement ERROR 20000: Case not found for CASE statement
drop procedure bug3287| drop procedure bug3287|
drop table if exists t3|
create table t3 (s1 int, primary key (s1))| create table t3 (s1 int, primary key (s1))|
insert into t3 values (5),(6)| insert into t3 values (5),(6)|
create procedure bug3279(out y int) create procedure bug3279(out y int)
@ -457,7 +449,6 @@ create procedure bug4344() drop procedure bug4344|
ERROR HY000: Can't drop or alter a PROCEDURE from within another stored routine ERROR HY000: Can't drop or alter a PROCEDURE from within another stored routine
create procedure bug4344() drop function bug4344| create procedure bug4344() drop function bug4344|
ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine
drop procedure if exists bug3294|
create procedure bug3294() create procedure bug3294()
begin begin
declare continue handler for sqlexception drop table t5; declare continue handler for sqlexception drop table t5;
@ -468,10 +459,6 @@ create table t5 (x int)|
call bug3294()| call bug3294()|
ERROR 42S02: Unknown table 'test.t5' ERROR 42S02: Unknown table 'test.t5'
drop procedure bug3294| drop procedure bug3294|
drop procedure if exists bug8776_1|
drop procedure if exists bug8776_2|
drop procedure if exists bug8776_3|
drop procedure if exists bug8776_4|
create procedure bug8776_1() create procedure bug8776_1()
begin begin
declare continue handler for sqlstate '42S0200test' begin end; declare continue handler for sqlstate '42S0200test' begin end;
@ -505,7 +492,6 @@ ERROR 0A000: LOCK is not allowed in stored procedures
create procedure bug6600() create procedure bug6600()
unlock table t1| unlock table t1|
ERROR 0A000: UNLOCK is not allowed in stored procedures ERROR 0A000: UNLOCK is not allowed in stored procedures
drop procedure if exists bug9566|
create procedure bug9566() create procedure bug9566()
begin begin
select * from t1; select * from t1;
@ -515,7 +501,6 @@ alter procedure bug9566 comment 'Some comment'|
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables| unlock tables|
drop procedure bug9566| drop procedure bug9566|
drop procedure if exists bug7299|
create procedure bug7299() create procedure bug7299()
begin begin
declare v int; declare v int;
@ -556,7 +541,6 @@ declare exit handler for condname1 select 1;
declare exit handler for sqlstate '42000' select 2; declare exit handler for sqlstate '42000' select 2;
end| end|
ERROR 42000: Duplicate handler declared in the same block ERROR 42000: Duplicate handler declared in the same block
drop procedure if exists bug9073|
create procedure bug9073() create procedure bug9073()
begin begin
declare condname1 condition for sqlstate '42000'; declare condname1 condition for sqlstate '42000';
@ -597,8 +581,6 @@ select b;
return b; return b;
end| end|
ERROR 0A000: Not allowed to return a result set from a function ERROR 0A000: Not allowed to return a result set from a function
drop function if exists bug8408_f|
drop procedure if exists bug8408_p|
create function bug8408_f() returns int create function bug8408_f() returns int
begin begin
call bug8408_p(); call bug8408_p();
@ -626,11 +608,9 @@ val x bug8408()
7 7 3 7 7 3
drop function bug8408| drop function bug8408|
truncate table t1| truncate table t1|
drop procedure if exists bug10537|
create procedure bug10537() create procedure bug10537()
load data local infile '/tmp/somefile' into table t1| load data local infile '/tmp/somefile' into table t1|
ERROR 0A000: LOAD DATA is not allowed in stored procedures ERROR 0A000: LOAD DATA is not allowed in stored procedures
drop function if exists bug8409|
create function bug8409() create function bug8409()
returns int returns int
begin begin
@ -681,7 +661,6 @@ create procedure bug9529_9012345678901234567890123456789012345678901234567890123
begin begin
end| end|
ERROR 42000: Identifier name 'bug9529_901234567890123456789012345678901234567890123456789012345' is too long ERROR 42000: Identifier name 'bug9529_901234567890123456789012345678901234567890123456789012345' is too long
drop procedure if exists bug17015_0123456789012345678901234567890123456789012345678901234|
create procedure bug17015_0123456789012345678901234567890123456789012345678901234() create procedure bug17015_0123456789012345678901234567890123456789012345678901234()
begin begin
end| end|
@ -689,7 +668,6 @@ show procedure status like 'bug17015%'|
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test bug17015_0123456789012345678901234567890123456789012345678901234 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci test bug17015_0123456789012345678901234567890123456789012345678901234 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
drop procedure bug17015_0123456789012345678901234567890123456789012345678901234| drop procedure bug17015_0123456789012345678901234567890123456789012345678901234|
drop procedure if exists bug10969|
create procedure bug10969() create procedure bug10969()
begin begin
declare s1 int default 0; declare s1 int default 0;
@ -733,10 +711,6 @@ TEMP_SUM
ERROR 24000: Cursor is not open ERROR 24000: Cursor is not open
drop procedure SP001; drop procedure SP001;
drop table t1, t2; drop table t1, t2;
drop function if exists bug11394|
drop function if exists bug11394_1|
drop function if exists bug11394_2|
drop procedure if exists bug11394|
create function bug11394(i int) returns int create function bug11394(i int) returns int
begin begin
if i <= 0 then if i <= 0 then
@ -784,8 +758,6 @@ CREATE TABLE t_bug_12490(a int);
CREATE TRIGGER BUG_12490 BEFORE UPDATE ON t_bug_12490 FOR EACH ROW HELP CONTENTS; CREATE TRIGGER BUG_12490 BEFORE UPDATE ON t_bug_12490 FOR EACH ROW HELP CONTENTS;
ERROR 0A000: HELP is not allowed in stored procedures ERROR 0A000: HELP is not allowed in stored procedures
DROP TABLE t_bug_12490; DROP TABLE t_bug_12490;
drop function if exists bug11834_1;
drop function if exists bug11834_2;
create function bug11834_1() returns int return 10; create function bug11834_1() returns int return 10;
create function bug11834_2() returns int return bug11834_1(); create function bug11834_2() returns int return bug11834_1();
prepare stmt from "select bug11834_2()"; prepare stmt from "select bug11834_2()";
@ -800,14 +772,12 @@ execute stmt;
ERROR 42000: FUNCTION test.bug11834_1 does not exist ERROR 42000: FUNCTION test.bug11834_1 does not exist
deallocate prepare stmt; deallocate prepare stmt;
drop function bug11834_2; drop function bug11834_2;
DROP FUNCTION IF EXISTS bug12953|
CREATE FUNCTION bug12953() RETURNS INT CREATE FUNCTION bug12953() RETURNS INT
BEGIN BEGIN
OPTIMIZE TABLE t1; OPTIMIZE TABLE t1;
RETURN 1; RETURN 1;
END| END|
ERROR 0A000: Not allowed to return a result set from a function ERROR 0A000: Not allowed to return a result set from a function
DROP FUNCTION IF EXISTS bug12995|
CREATE FUNCTION bug12995() RETURNS INT CREATE FUNCTION bug12995() RETURNS INT
BEGIN BEGIN
HANDLER t1 OPEN; HANDLER t1 OPEN;
@ -828,8 +798,6 @@ END|
ERROR 0A000: HANDLER is not allowed in stored procedures ERROR 0A000: HANDLER is not allowed in stored procedures
SELECT bug12995()| SELECT bug12995()|
ERROR 42000: FUNCTION test.bug12995 does not exist ERROR 42000: FUNCTION test.bug12995 does not exist
drop procedure if exists bug12712;
drop function if exists bug12712;
create procedure bug12712() create procedure bug12712()
set session autocommit = 0; set session autocommit = 0;
select @@autocommit; select @@autocommit;
@ -875,10 +843,6 @@ ERROR HY000: Not allowed to set autocommit from a stored function or trigger
create trigger bug12712 create trigger bug12712
before insert on t1 for each row set session autocommit = 0; before insert on t1 for each row set session autocommit = 0;
ERROR HY000: Not allowed to set autocommit from a stored function or trigger ERROR HY000: Not allowed to set autocommit from a stored function or trigger
drop procedure if exists bug13510_1|
drop procedure if exists bug13510_2|
drop procedure if exists bug13510_3|
drop procedure if exists bug13510_4|
create procedure bug13510_1() create procedure bug13510_1()
begin begin
declare password varchar(10); declare password varchar(10);
@ -915,7 +879,6 @@ names
foo4 foo4
drop procedure bug13510_3| drop procedure bug13510_3|
drop procedure bug13510_4| drop procedure bug13510_4|
drop function if exists bug_13627_f|
CREATE TABLE t1 (a int)| CREATE TABLE t1 (a int)|
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DROP TRIGGER test1; END | CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DROP TRIGGER test1; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
@ -1058,9 +1021,6 @@ select count(*) into param1 from t3;
end| end|
ERROR 3D000: No database selected ERROR 3D000: No database selected
use test; use test;
DROP PROCEDURE IF EXISTS bug13037_p1;
DROP PROCEDURE IF EXISTS bug13037_p2;
DROP PROCEDURE IF EXISTS bug13037_p3;
CREATE PROCEDURE bug13037_p1() CREATE PROCEDURE bug13037_p1()
BEGIN BEGIN
IF bug13037_foo THEN IF bug13037_foo THEN
@ -1078,13 +1038,13 @@ SELECT bug13037_foo;
END| END|
CALL bug13037_p2(); CALL bug13037_p2();
ERROR 42S22: Unknown column 'bug13037_bar' in 'field list' ERROR 42S22: Unknown column 'bug13037_bar' in 'SET'
CALL bug13037_p3(); CALL bug13037_p3();
ERROR 42S22: Unknown column 'bug13037_foo' in 'field list' ERROR 42S22: Unknown column 'bug13037_foo' in 'SELECT'
CALL bug13037_p2(); CALL bug13037_p2();
ERROR 42S22: Unknown column 'bug13037_bar' in 'field list' ERROR 42S22: Unknown column 'bug13037_bar' in 'SET'
CALL bug13037_p3(); CALL bug13037_p3();
ERROR 42S22: Unknown column 'bug13037_foo' in 'field list' ERROR 42S22: Unknown column 'bug13037_foo' in 'SELECT'
DROP PROCEDURE bug13037_p2; DROP PROCEDURE bug13037_p2;
DROP PROCEDURE bug13037_p3; DROP PROCEDURE bug13037_p3;
create database mysqltest1; create database mysqltest1;
@ -1100,7 +1060,6 @@ Db Name Type Definer Modified Created Security_type Comment character_set_client
mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
drop database mysqltest2; drop database mysqltest2;
use test; use test;
DROP FUNCTION IF EXISTS bug13012|
CREATE FUNCTION bug13012() RETURNS INT CREATE FUNCTION bug13012() RETURNS INT
BEGIN BEGIN
REPAIR TABLE t1; REPAIR TABLE t1;
@ -1119,9 +1078,6 @@ ERROR 0A000: Not allowed to return a result set from a function
drop table t1| drop table t1|
drop procedure bug13012_1| drop procedure bug13012_1|
drop function bug13012_2| drop function bug13012_2|
drop function if exists bug11555_1;
drop function if exists bug11555_2;
drop view if exists v1, v2, v3, v4;
create function bug11555_1() returns int return (select max(i) from t1); create function bug11555_1() returns int return (select max(i) from t1);
create function bug11555_2() returns int return bug11555_1(); create function bug11555_2() returns int return bug11555_1();
create view v1 as select bug11555_1(); create view v1 as select bug11555_1();
@ -1158,7 +1114,6 @@ ERROR 42S02: Table 'test.t2' doesn't exist
drop function bug11555_1; drop function bug11555_1;
drop table t1; drop table t1;
drop view v1; drop view v1;
drop procedure if exists ` bug15658`;
create procedure ``() select 1; create procedure ``() select 1;
ERROR 42000: Incorrect routine name '' ERROR 42000: Incorrect routine name ''
create procedure ` `() select 1; create procedure ` `() select 1;
@ -1177,8 +1132,6 @@ show procedure status;
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test bug15658 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci test bug15658 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
drop procedure ` bug15658`; drop procedure ` bug15658`;
drop function if exists bug14270;
drop table if exists t1;
create table t1 (s1 int primary key); create table t1 (s1 int primary key);
create function bug14270() returns int create function bug14270() returns int
begin begin
@ -1193,7 +1146,6 @@ return 1;
end| end|
ERROR 0A000: Not allowed to return a result set from a function ERROR 0A000: Not allowed to return a result set from a function
drop table t1; drop table t1;
drop procedure if exists bug15091;
create procedure bug15091() create procedure bug15091()
begin begin
declare selectstr varchar(6000) default ' '; declare selectstr varchar(6000) default ' ';
@ -1204,10 +1156,8 @@ c.operatorid,
'in (',conditionstr, ')'); 'in (',conditionstr, ')');
end| end|
ERROR 42000: Undeclared variable: c ERROR 42000: Undeclared variable: c
drop function if exists bug16896;
create aggregate function bug16896() returns int return 1; create aggregate function bug16896() returns int return 1;
ERROR HY000: Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function ERROR HY000: Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function
DROP PROCEDURE IF EXISTS bug14702;
CREATE IF NOT EXISTS PROCEDURE bug14702() CREATE IF NOT EXISTS PROCEDURE bug14702()
BEGIN BEGIN
END; END;
@ -1218,7 +1168,6 @@ CREATE PROCEDURE IF NOT EXISTS bug14702()
BEGIN BEGIN
END; END;
DROP PROCEDURE IF EXISTS bug14702; DROP PROCEDURE IF EXISTS bug14702;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT); CREATE TABLE t1 (i INT);
CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 INTO @a; CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 INTO @a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @a' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @a' at line 1
@ -1242,30 +1191,23 @@ ERROR HY000: View's SELECT contains a variable or parameter
PREPARE stmt FROM "CREATE VIEW v AS SELECT ?"; PREPARE stmt FROM "CREATE VIEW v AS SELECT ?";
ERROR HY000: View's SELECT contains a variable or parameter ERROR HY000: View's SELECT contains a variable or parameter
DROP TABLE t1; DROP TABLE t1;
drop tables if exists t1;
drop procedure if exists bug24491;
create table t1 (id int primary key auto_increment, value varchar(10)); create table t1 (id int primary key auto_increment, value varchar(10));
insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD'); insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD');
create procedure bug24491() create procedure bug24491()
insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP'; insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP';
call bug24491(); call bug24491();
ERROR 42S22: Unknown column 'v' in 'field list' ERROR 42S22: Unknown column 'v' in 'UPDATE'
call bug24491(); call bug24491();
ERROR 42S22: Unknown column 'v' in 'field list' ERROR 42S22: Unknown column 'v' in 'UPDATE'
drop procedure bug24491; drop procedure bug24491;
create procedure bug24491() create procedure bug24491()
insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP'; insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP';
call bug24491(); call bug24491();
ERROR 42S22: Unknown column 'y.value' in 'field list' ERROR 42S22: Unknown column 'y.value' in 'UPDATE'
call bug24491(); call bug24491();
ERROR 42S22: Unknown column 'y.value' in 'field list' ERROR 42S22: Unknown column 'y.value' in 'UPDATE'
drop procedure bug24491; drop procedure bug24491;
drop tables t1; drop tables t1;
DROP FUNCTION IF EXISTS bug18914_f1;
DROP FUNCTION IF EXISTS bug18914_f2;
DROP PROCEDURE IF EXISTS bug18914_p1;
DROP PROCEDURE IF EXISTS bug18914_p2;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (i INT); CREATE TABLE t1 (i INT);
CREATE PROCEDURE bug18914_p1() CREATE TABLE t2 (i INT); CREATE PROCEDURE bug18914_p1() CREATE TABLE t2 (i INT);
CREATE PROCEDURE bug18914_p2() DROP TABLE IF EXISTS no_such_table; CREATE PROCEDURE bug18914_p2() DROP TABLE IF EXISTS no_such_table;
@ -1294,9 +1236,6 @@ DROP FUNCTION bug18914_f2;
DROP PROCEDURE bug18914_p1; DROP PROCEDURE bug18914_p1;
DROP PROCEDURE bug18914_p2; DROP PROCEDURE bug18914_p2;
DROP TABLE t1; DROP TABLE t1;
drop table if exists bogus_table_20713;
drop function if exists func_20713_a;
drop function if exists func_20713_b;
create table bogus_table_20713( id int(10) not null primary key); create table bogus_table_20713( id int(10) not null primary key);
insert into bogus_table_20713 values (1), (2), (3); insert into bogus_table_20713 values (1), (2), (3);
create function func_20713_a() returns int(11) create function func_20713_a() returns int(11)
@ -1348,11 +1287,6 @@ select @in_func;
2 2
drop function if exists func_20713_a; drop function if exists func_20713_a;
drop function if exists func_20713_b; drop function if exists func_20713_b;
drop table if exists table_25345_a;
drop table if exists table_25345_b;
drop procedure if exists proc_25345;
drop function if exists func_25345;
drop function if exists func_25345_b;
create table table_25345_a (a int); create table table_25345_a (a int);
create table table_25345_b (b int); create table table_25345_b (b int);
create procedure proc_25345() create procedure proc_25345()
@ -1394,14 +1328,12 @@ drop procedure proc_25345;
drop function func_25345; drop function func_25345;
drop function func_25345_b; drop function func_25345_b;
End of 5.0 tests End of 5.0 tests
drop function if exists bug16164;
create function bug16164() returns int create function bug16164() returns int
begin begin
show authors; show authors;
return 42; return 42;
end| end|
ERROR 0A000: Not allowed to return a result set from a function ERROR 0A000: Not allowed to return a result set from a function
drop function if exists bug20701;
create function bug20701() returns varchar(25) binary return "test"; create function bug20701() returns varchar(25) binary return "test";
drop function bug20701; drop function bug20701;
create function bug20701() returns varchar(25) return "test"; create function bug20701() returns varchar(25) return "test";
@ -1458,8 +1390,6 @@ end
until true end repeat retry; until true end repeat retry;
end// end//
ERROR 42000: LEAVE with no matching label: retry ERROR 42000: LEAVE with no matching label: retry
drop procedure if exists proc_28360;
drop function if exists func_28360;
CREATE PROCEDURE proc_28360() CREATE PROCEDURE proc_28360()
BEGIN BEGIN
ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME; ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME;
@ -1471,7 +1401,6 @@ ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME;
RETURN 0; RETURN 0;
END// END//
ERROR HY000: Can't drop or alter a DATABASE from within another stored routine ERROR HY000: Can't drop or alter a DATABASE from within another stored routine
DROP PROCEDURE IF EXISTS p1;
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
DECLARE c char(100); DECLARE c char(100);
@ -1487,7 +1416,6 @@ FETCH cur1 INTO c;
select c; select c;
CLOSE cur1; CLOSE cur1;
END' at line 4 END' at line 4
DROP DATABASE IF EXISTS mysqltest;
CREATE DATABASE mysqltest; CREATE DATABASE mysqltest;
USE mysqltest; USE mysqltest;
DROP DATABASE mysqltest; DROP DATABASE mysqltest;
@ -1509,9 +1437,6 @@ ERROR HY000: Not allowed to set autocommit from a stored function or trigger
create trigger t1 create trigger t1
before insert on t2 for each row set password = password('foo');| before insert on t2 for each row set password = password('foo');|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger ERROR HY000: Not allowed to set autocommit from a stored function or trigger
drop function if exists f1;
drop function if exists f2;
drop table if exists t1, t2;
create function f1() returns int create function f1() returns int
begin begin
drop temporary table t1; drop temporary table t1;
@ -1557,10 +1482,6 @@ drop function f2;
drop table t2; drop table t2;
ERROR 42S02: Unknown table 'test.t2' ERROR 42S02: Unknown table 'test.t2'
End of 5.1 tests End of 5.1 tests
drop procedure if exists proc_33983_a;
drop procedure if exists proc_33983_b;
drop procedure if exists proc_33983_c;
drop procedure if exists proc_33983_d;
create procedure proc_33983_a() create procedure proc_33983_a()
begin begin
label1: label1:
@ -1612,7 +1533,6 @@ CALL p1((SELECT * FROM t1))|
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
DROP PROCEDURE IF EXISTS p1| DROP PROCEDURE IF EXISTS p1|
DROP TABLE t1| DROP TABLE t1|
drop procedure if exists p1;
create procedure p1() create procedure p1()
begin begin
create table t1 (a int) engine=MyISAM; create table t1 (a int) engine=MyISAM;
@ -1621,7 +1541,6 @@ end|
call p1(); call p1();
call p1(); call p1();
drop procedure p1; drop procedure p1;
drop procedure if exists proc_8759;
create procedure proc_8759() create procedure proc_8759()
begin begin
declare should_be_illegal condition for sqlstate '00000'; declare should_be_illegal condition for sqlstate '00000';
@ -1633,7 +1552,6 @@ begin
declare continue handler for sqlstate '00000' set @x=0; declare continue handler for sqlstate '00000' set @x=0;
end$$ end$$
ERROR 42000: Bad SQLSTATE: '00000' ERROR 42000: Bad SQLSTATE: '00000'
drop procedure if exists proc_36510;
create procedure proc_36510() create procedure proc_36510()
begin begin
declare should_be_illegal condition for sqlstate '00123'; declare should_be_illegal condition for sqlstate '00123';
@ -1656,7 +1574,6 @@ begin
declare continue handler for 0 set @x=0; declare continue handler for 0 set @x=0;
end$$ end$$
ERROR HY000: Incorrect CONDITION value: '0' ERROR HY000: Incorrect CONDITION value: '0'
drop procedure if exists p1;
set @old_recursion_depth = @@max_sp_recursion_depth; set @old_recursion_depth = @@max_sp_recursion_depth;
set @@max_sp_recursion_depth = 255; set @@max_sp_recursion_depth = 255;
create procedure p1(a int) create procedure p1(a int)
@ -1728,12 +1645,6 @@ End of 5.1 tests
# - Case 1 # - Case 1
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
DROP PROCEDURE IF EXISTS p3;
DROP PROCEDURE IF EXISTS p4;
DROP PROCEDURE IF EXISTS p5;
DROP PROCEDURE IF EXISTS p6;
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
SELECT CAST('10 ' as unsigned integer); SELECT CAST('10 ' as unsigned integer);
@ -1827,7 +1738,6 @@ DROP PROCEDURE p6;
# - Case 3: check that "Exception trumps No Data". # - Case 3: check that "Exception trumps No Data".
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT); CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2), (3); INSERT INTO t1 VALUES (1), (2), (3);
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
@ -1856,8 +1766,6 @@ DROP TABLE t1;
# #
# Bug#36185: Incorrect precedence for warning and exception handlers # Bug#36185: Incorrect precedence for warning and exception handlers
# #
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS p1;
CREATE TABLE t1 (a INT, b INT NOT NULL); CREATE TABLE t1 (a INT, b INT NOT NULL);
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
@ -1929,9 +1837,6 @@ SET sql_mode = @sql_mode_saved;
# #
# Bug#55850: Trigger warnings not cleared. # Bug#55850: Trigger warnings not cleared.
# #
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP PROCEDURE IF EXISTS p1;
CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT); CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT);
CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT, CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT,
d SMALLINT, e SMALLINT, f SMALLINT); d SMALLINT, e SMALLINT, f SMALLINT);
@ -2551,8 +2456,6 @@ DROP PROCEDURE p13;
# Bug#12731619: NESTED SP HANDLERS CAN TRIGGER ASSERTION # Bug#12731619: NESTED SP HANDLERS CAN TRIGGER ASSERTION
DROP FUNCTION IF EXISTS f1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(msg VARCHAR(255)); CREATE TABLE t1(msg VARCHAR(255));
CREATE FUNCTION f1() RETURNS INT CREATE FUNCTION f1() RETURNS INT
BEGIN BEGIN
@ -2593,13 +2496,6 @@ DROP TABLE t1;
# Check that handled SQL-conditions are properly cleared from DA. # Check that handled SQL-conditions are properly cleared from DA.
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
DROP PROCEDURE IF EXISTS p3;
DROP PROCEDURE IF EXISTS p4;
DROP PROCEDURE IF EXISTS p5;
CREATE TABLE t1(a CHAR, b CHAR, c CHAR); CREATE TABLE t1(a CHAR, b CHAR, c CHAR);
CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT); CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT);
@ -2769,8 +2665,6 @@ DROP TABLE t2;
# Check DECLARE statements that raise conditions before handlers # Check DECLARE statements that raise conditions before handlers
# are declared. # are declared.
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
SET sql_mode = ''| SET sql_mode = ''|
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
@ -2798,8 +2692,6 @@ DROP PROCEDURE p2;
# #
# Bug#13113222 RQG_SIGNAL_RESIGNAL FAILED WITH ASSERTION. # Bug#13113222 RQG_SIGNAL_RESIGNAL FAILED WITH ASSERTION.
# #
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT 'triggered p1'; DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT 'triggered p1';
@ -2825,9 +2717,6 @@ DROP PROCEDURE p2;
# Bug#12652873: 61392: Continue handler for NOT FOUND being triggered # Bug#12652873: 61392: Continue handler for NOT FOUND being triggered
# from internal stored function. # from internal stored function.
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT, b INT); CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1, 2); INSERT INTO t1 VALUES (1, 2);

File diff suppressed because it is too large Load Diff

View File

@ -4448,7 +4448,7 @@ begin
update t3 set id=2, county=value(c); update t3 set id=2, county=value(c);
end| end|
call bug15441('county')| call bug15441('county')|
ERROR 42S22: Unknown column 'c' in 'field list' ERROR 42S22: Unknown column 'c' in 'SET'
drop procedure bug15441| drop procedure bug15441|
create procedure bug15441(county varchar(25)) create procedure bug15441(county varchar(25))
begin begin
@ -6940,9 +6940,9 @@ BEGIN
SELECT a FROM t1 A WHERE A.b IN (SELECT b FROM t2 AS B); SELECT a FROM t1 A WHERE A.b IN (SELECT b FROM t2 AS B);
END| END|
CALL p1; CALL p1;
ERROR 42S22: Unknown column 'A.b' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'A.b' in 'IN/ALL/ANY'
CALL p1; CALL p1;
ERROR 42S22: Unknown column 'A.b' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'A.b' in 'IN/ALL/ANY'
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
@ -7251,7 +7251,7 @@ insert into t1 (a) values (1), (2), (3), (4), (5);
# we drop and re-create the procedure. # we drop and re-create the procedure.
# #
call p1(); call p1();
ERROR 42S22: Unknown column 'test.t1.c1' in 'field list' ERROR 42S22: Unknown column 'test.t1.c1' in 'SELECT'
# #
# Drop and recreate the procedure, then repeat # Drop and recreate the procedure, then repeat
# #
@ -7915,11 +7915,11 @@ drop table t1,t2;
CREATE TABLE t1 (a INT, b VARCHAR(32)); CREATE TABLE t1 (a INT, b VARCHAR(32));
CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c); CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c);
CALL sp; CALL sp;
ERROR 42S22: Unknown column 'c' in 'from clause' ERROR 42S22: Unknown column 'c' in 'FROM'
CALL sp; CALL sp;
ERROR 42S22: Unknown column 'c' in 'from clause' ERROR 42S22: Unknown column 'c' in 'FROM'
CALL sp; CALL sp;
ERROR 42S22: Unknown column 'c' in 'from clause' ERROR 42S22: Unknown column 'c' in 'FROM'
alter table t1 add column c int; alter table t1 add column c int;
CALL sp; CALL sp;
c a b a b c a b a b
@ -7938,11 +7938,11 @@ CALL sp;
ERROR HY000: Table 'v1' was not locked with LOCK TABLES ERROR HY000: Table 'v1' was not locked with LOCK TABLES
UNLOCK TABLES; UNLOCK TABLES;
CALL sp; CALL sp;
ERROR 42S22: Unknown column 'b' in 'order clause' ERROR 42S22: Unknown column 'b' in 'ORDER BY'
CALL sp; CALL sp;
ERROR 42S22: Unknown column 'b' in 'order clause' ERROR 42S22: Unknown column 'b' in 'ORDER BY'
CALL sp; CALL sp;
ERROR 42S22: Unknown column 'b' in 'order clause' ERROR 42S22: Unknown column 'b' in 'ORDER BY'
DROP PROCEDURE sp; DROP PROCEDURE sp;
CREATE PROCEDURE sp() UPDATE v1 SET a = 1 WHERE a=1 and b=2; CREATE PROCEDURE sp() UPDATE v1 SET a = 1 WHERE a=1 and b=2;
LOCK TABLE t2 READ; LOCK TABLE t2 READ;
@ -7950,11 +7950,11 @@ CALL sp;
ERROR HY000: Table 'v1' was not locked with LOCK TABLES ERROR HY000: Table 'v1' was not locked with LOCK TABLES
UNLOCK TABLES; UNLOCK TABLES;
CALL sp; CALL sp;
ERROR 42S22: Unknown column 'b' in 'where clause' ERROR 42S22: Unknown column 'b' in 'WHERE'
CALL sp; CALL sp;
ERROR 42S22: Unknown column 'b' in 'where clause' ERROR 42S22: Unknown column 'b' in 'WHERE'
CALL sp; CALL sp;
ERROR 42S22: Unknown column 'b' in 'where clause' ERROR 42S22: Unknown column 'b' in 'WHERE'
DROP PROCEDURE sp; DROP PROCEDURE sp;
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
@ -8386,7 +8386,7 @@ DROP PROCEDURE p1;
# #
CREATE OR REPLACE PROCEDURE p1 (a VARCHAR(10)) SELECT 1; CREATE OR REPLACE PROCEDURE p1 (a VARCHAR(10)) SELECT 1;
CALL p1(a); CALL p1(a);
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'CALL'
drop procedure p1; drop procedure p1;
CREATE OR REPLACE PROCEDURE p1 (a VARCHAR(10)) SELECT a| CREATE OR REPLACE PROCEDURE p1 (a VARCHAR(10)) SELECT a|
CREATE OR REPLACE PROCEDURE p2 () CREATE OR REPLACE PROCEDURE p2 ()

View File

@ -2183,7 +2183,7 @@ SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA',
Kundentyp kategorie Kundentyp kategorie
Privat (Private Nutzung) Mobilfunk Privat (Private Nutzung) Mobilfunk
Warnings: Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous Warning 1052 Column 'kundentyp' in GROUP BY is ambiguous
drop table t1; drop table t1;
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
have_ssl have_ssl

View File

@ -2162,7 +2162,7 @@ SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA',
Kundentyp kategorie Kundentyp kategorie
Privat (Private Nutzung) Mobilfunk Privat (Private Nutzung) Mobilfunk
Warnings: Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous Warning 1052 Column 'kundentyp' in GROUP BY is ambiguous
drop table t1; drop table t1;
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
have_ssl have_ssl

View File

@ -63,12 +63,12 @@ SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1 1
1 1
SELECT (SELECT 1), a; SELECT (SELECT 1), a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
a a
1 1
SELECT 1 FROM (SELECT (SELECT a) b) c; SELECT 1 FROM (SELECT (SELECT a) b) c;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
id id
1 1
@ -85,9 +85,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: PROCEDURE does not support subqueries or stored functions ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1,2,3) = ROW(1,2,3); SELECT (SELECT 1,2,3) = ROW(1,2,3);
(SELECT 1,2,3) = ROW(1,2,3) (SELECT 1,2,3) = ROW(1,2,3)
1 1
@ -370,7 +370,7 @@ Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous ERROR 23000: Column 'a' in SELECT is ambiguous
drop table t1,t2,t3; drop table t1,t2,t3;
CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0'); CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b'); INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
@ -481,9 +481,9 @@ numeropost maxnumrep
43506 2 43506 2
40143 1 40143 1
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b; SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT 1 IN (SELECT 1 FROM t2 HAVING a); SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic); SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic);
mot topic date pseudo mot topic date pseudo
joce 40143 2002-10-22 joce joce 40143 2002-10-22 joce
@ -576,7 +576,7 @@ KEY `pseudo` (`pseudo`,`numeropost`)
SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a; SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list) ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list)
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1) numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test'); INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
@ -1404,7 +1404,7 @@ INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t); UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
ERROR 42S22: Unknown column 't.i' in 'field list' ERROR 42S22: Unknown column 't.i' in 'SET'
select * from t1; select * from t1;
i i
3 3
@ -1608,7 +1608,7 @@ create table t2 (s1 int);
insert into t1 values (1); insert into t1 values (1);
insert into t2 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); update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
ERROR 42S22: Unknown column 'x.s1' in 'field list' ERROR 42S22: Unknown column 'x.s1' in 'SELECT'
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
s2 CHAR(5) COLLATE latin1_swedish_ci); s2 CHAR(5) COLLATE latin1_swedish_ci);
@ -1842,11 +1842,11 @@ drop table t1, t2;
create table t1 (s1 int); create table t1 (s1 int);
create table t2 (s1 int); create table t2 (s1 int);
select * from t1 where (select count(*) from t2 where t1.s2) = 1; select * from t1 where (select count(*) from t2 where t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'where clause' ERROR 42S22: Unknown column 't1.s2' in 'WHERE'
select * from t1 where (select count(*) from t2 group by t1.s2) = 1; select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
select count(*) from t2 group by t1.s2; select count(*) from t2 group by t1.s2;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB)); CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA)); CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
@ -2649,7 +2649,7 @@ INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,
CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ; CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a'); INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ERROR 42S22: Unknown column 'b.sc' in 'field list' ERROR 42S22: Unknown column 'b.sc' in 'SELECT'
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ac ac
700 700
@ -2740,7 +2740,7 @@ drop table t1;
create table t1 (a1 int); create table t1 (a1 int);
create table t2 (b1 int); create table t2 (b1 int);
select * from t1 where a2 > any(select b1 from t2); select * from t1 where a2 > any(select b1 from t2);
ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY'
select * from t1 where a1 > any(select b1 from t2); select * from t1 where a1 > any(select b1 from t2);
a1 a1
drop table t1,t2; drop table t1,t2;
@ -3665,11 +3665,11 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1); CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause' ERROR 42S22: Unknown column 'no_such_column' in 'WHERE'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
DROP TABLE t1; DROP TABLE t1;
create table t1 (i int, j bigint); create table t1 (i int, j bigint);
insert into t1 values (1, 2), (2, 2), (3, 2); insert into t1 values (1, 2), (2, 2), (3, 2);
@ -4471,11 +4471,11 @@ EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
EXPLAIN EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 t1_outer SELECT a AS out_a, MIN(b) FROM t1 t1_outer
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
@ -5464,7 +5464,7 @@ INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1, EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1 (SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
WHERE t1.a = d1.a; WHERE t1.a = d1.a;
ERROR 42S22: Unknown column 'd1.a' in 'where clause' ERROR 42S22: Unknown column 'd1.a' in 'WHERE'
DROP TABLE t1; DROP TABLE t1;
Set up test tables. Set up test tables.
CREATE TABLE t1 ( CREATE TABLE t1 (

View File

@ -886,13 +886,13 @@ SELECT c FROM
(SELECT COUNT(b) FROM t1) AS x GROUP BY c (SELECT COUNT(b) FROM t1) AS x GROUP BY c
) FROM t1 GROUP BY b ) FROM t1 GROUP BY b
) AS y; ) AS y;
ERROR 42S22: Unknown column 'c' in 'field list' ERROR 42S22: Unknown column 'c' in 'SELECT'
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
Note 1981 Aggregate function 'count()' of SELECT #3 belongs to SELECT #2 Note 1981 Aggregate function 'count()' of SELECT #3 belongs to SELECT #2
Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2 Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
Error 1054 Unknown column 'c' in 'field list' Error 1054 Unknown column 'c' in 'SELECT'
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
# #
@ -1443,7 +1443,7 @@ CALL p1;
f1 f1
ALTER TABLE t2 CHANGE COLUMN f1 my_column INT; ALTER TABLE t2 CHANGE COLUMN f1 my_column INT;
CALL p1; CALL p1;
ERROR 42S22: Unknown column 'f1' in 'where clause' ERROR 42S22: Unknown column 'f1' in 'WHERE'
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #

View File

@ -889,13 +889,13 @@ SELECT c FROM
(SELECT COUNT(b) FROM t1) AS x GROUP BY c (SELECT COUNT(b) FROM t1) AS x GROUP BY c
) FROM t1 GROUP BY b ) FROM t1 GROUP BY b
) AS y; ) AS y;
ERROR 42S22: Unknown column 'c' in 'field list' ERROR 42S22: Unknown column 'c' in 'SELECT'
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
Note 1981 Aggregate function 'count()' of SELECT #3 belongs to SELECT #2 Note 1981 Aggregate function 'count()' of SELECT #3 belongs to SELECT #2
Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2 Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
Error 1054 Unknown column 'c' in 'field list' Error 1054 Unknown column 'c' in 'SELECT'
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
# #
@ -1446,7 +1446,7 @@ CALL p1;
f1 f1
ALTER TABLE t2 CHANGE COLUMN f1 my_column INT; ALTER TABLE t2 CHANGE COLUMN f1 my_column INT;
CALL p1; CALL p1;
ERROR 42S22: Unknown column 'f1' in 'where clause' ERROR 42S22: Unknown column 'f1' in 'WHERE'
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #

View File

@ -2696,7 +2696,7 @@ DROP TABLE t1, t2;
CREATE TABLE t1(a INT, b INT); CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id); SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id);
ERROR 42S22: Unknown column 's.id' in 'group statement' ERROR 42S22: Unknown column 's.id' in 'GROUP BY'
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-24519: Server crashes in Charset::set_charset upon SELECT # MDEV-24519: Server crashes in Charset::set_charset upon SELECT

View File

@ -5,7 +5,7 @@ set optimizer_switch='exists_to_in=on';
# #
CREATE TABLE t1 (f1 integer); CREATE TABLE t1 (f1 integer);
SELECT * FROM t1 WHERE EXISTS (SELECT NO_SUCH_TABLE.NO_SUCH_FIELD FROM t1); SELECT * FROM t1 WHERE EXISTS (SELECT NO_SUCH_TABLE.NO_SUCH_FIELD FROM t1);
ERROR 42S22: Unknown column 'NO_SUCH_TABLE.NO_SUCH_FIELD' in 'field list' ERROR 42S22: Unknown column 'NO_SUCH_TABLE.NO_SUCH_FIELD' in 'SELECT'
drop table t1; drop table t1;
# #
# LP BUG#884657 Wrong result with exists2in , correlated subquery # LP BUG#884657 Wrong result with exists2in , correlated subquery

View File

@ -67,12 +67,12 @@ SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1 1
1 1
SELECT (SELECT 1), a; SELECT (SELECT 1), a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
a a
1 1
SELECT 1 FROM (SELECT (SELECT a) b) c; SELECT 1 FROM (SELECT (SELECT a) b) c;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
id id
1 1
@ -89,9 +89,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: PROCEDURE does not support subqueries or stored functions ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1,2,3) = ROW(1,2,3); SELECT (SELECT 1,2,3) = ROW(1,2,3);
(SELECT 1,2,3) = ROW(1,2,3) (SELECT 1,2,3) = ROW(1,2,3)
1 1
@ -374,7 +374,7 @@ Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 /* select#1 */ select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(/* select#2 */ select 1 from `test`.`t7` where `test`.`t7`.`uq` = `test`.`t6`.`clinic_uq` limit 1)) Note 1003 /* select#1 */ select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(/* select#2 */ select 1 from `test`.`t7` where `test`.`t7`.`uq` = `test`.`t6`.`clinic_uq` limit 1))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous ERROR 23000: Column 'a' in SELECT is ambiguous
drop table t1,t2,t3; drop table t1,t2,t3;
CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0'); CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b'); INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
@ -485,9 +485,9 @@ numeropost maxnumrep
43506 2 43506 2
40143 1 40143 1
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b; SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT 1 IN (SELECT 1 FROM t2 HAVING a); SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic); SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic);
mot topic date pseudo mot topic date pseudo
joce 40143 2002-10-22 joce joce 40143 2002-10-22 joce
@ -580,7 +580,7 @@ KEY `pseudo` (`pseudo`,`numeropost`)
SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a; SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list) ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list)
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1) numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test'); INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
@ -1408,7 +1408,7 @@ INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t); UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
ERROR 42S22: Unknown column 't.i' in 'field list' ERROR 42S22: Unknown column 't.i' in 'SET'
select * from t1; select * from t1;
i i
3 3
@ -1612,7 +1612,7 @@ create table t2 (s1 int);
insert into t1 values (1); insert into t1 values (1);
insert into t2 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); update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
ERROR 42S22: Unknown column 'x.s1' in 'field list' ERROR 42S22: Unknown column 'x.s1' in 'SELECT'
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
s2 CHAR(5) COLLATE latin1_swedish_ci); s2 CHAR(5) COLLATE latin1_swedish_ci);
@ -1846,11 +1846,11 @@ drop table t1, t2;
create table t1 (s1 int); create table t1 (s1 int);
create table t2 (s1 int); create table t2 (s1 int);
select * from t1 where (select count(*) from t2 where t1.s2) = 1; select * from t1 where (select count(*) from t2 where t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'where clause' ERROR 42S22: Unknown column 't1.s2' in 'WHERE'
select * from t1 where (select count(*) from t2 group by t1.s2) = 1; select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
select count(*) from t2 group by t1.s2; select count(*) from t2 group by t1.s2;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB)); CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA)); CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
@ -2652,7 +2652,7 @@ INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,
CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ; CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a'); INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ERROR 42S22: Unknown column 'b.sc' in 'field list' ERROR 42S22: Unknown column 'b.sc' in 'SELECT'
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ac ac
700 700
@ -2743,7 +2743,7 @@ drop table t1;
create table t1 (a1 int); create table t1 (a1 int);
create table t2 (b1 int); create table t2 (b1 int);
select * from t1 where a2 > any(select b1 from t2); select * from t1 where a2 > any(select b1 from t2);
ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY'
select * from t1 where a1 > any(select b1 from t2); select * from t1 where a1 > any(select b1 from t2);
a1 a1
drop table t1,t2; drop table t1,t2;
@ -3668,11 +3668,11 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1); CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause' ERROR 42S22: Unknown column 'no_such_column' in 'WHERE'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
DROP TABLE t1; DROP TABLE t1;
create table t1 (i int, j bigint); create table t1 (i int, j bigint);
insert into t1 values (1, 2), (2, 2), (3, 2); insert into t1 values (1, 2), (2, 2), (3, 2);
@ -4474,11 +4474,11 @@ EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
EXPLAIN EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 t1_outer SELECT a AS out_a, MIN(b) FROM t1 t1_outer
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
@ -5466,7 +5466,7 @@ INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1, EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1 (SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
WHERE t1.a = d1.a; WHERE t1.a = d1.a;
ERROR 42S22: Unknown column 'd1.a' in 'where clause' ERROR 42S22: Unknown column 'd1.a' in 'WHERE'
DROP TABLE t1; DROP TABLE t1;
Set up test tables. Set up test tables.
CREATE TABLE t1 ( CREATE TABLE t1 (

View File

@ -70,12 +70,12 @@ SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1 1
1 1
SELECT (SELECT 1), a; SELECT (SELECT 1), a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
a a
1 1
SELECT 1 FROM (SELECT (SELECT a) b) c; SELECT 1 FROM (SELECT (SELECT a) b) c;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
id id
1 1
@ -92,9 +92,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: PROCEDURE does not support subqueries or stored functions ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1,2,3) = ROW(1,2,3); SELECT (SELECT 1,2,3) = ROW(1,2,3);
(SELECT 1,2,3) = ROW(1,2,3) (SELECT 1,2,3) = ROW(1,2,3)
1 1
@ -377,7 +377,7 @@ Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous ERROR 23000: Column 'a' in SELECT is ambiguous
drop table t1,t2,t3; drop table t1,t2,t3;
CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0'); CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b'); INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
@ -488,9 +488,9 @@ numeropost maxnumrep
43506 2 43506 2
40143 1 40143 1
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b; SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT 1 IN (SELECT 1 FROM t2 HAVING a); SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic); SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic);
mot topic date pseudo mot topic date pseudo
joce 40143 2002-10-22 joce joce 40143 2002-10-22 joce
@ -583,7 +583,7 @@ KEY `pseudo` (`pseudo`,`numeropost`)
SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a; SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list) ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list)
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1) numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test'); INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
@ -1411,7 +1411,7 @@ INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t); UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
ERROR 42S22: Unknown column 't.i' in 'field list' ERROR 42S22: Unknown column 't.i' in 'SET'
select * from t1; select * from t1;
i i
3 3
@ -1615,7 +1615,7 @@ create table t2 (s1 int);
insert into t1 values (1); insert into t1 values (1);
insert into t2 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); update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
ERROR 42S22: Unknown column 'x.s1' in 'field list' ERROR 42S22: Unknown column 'x.s1' in 'SELECT'
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
s2 CHAR(5) COLLATE latin1_swedish_ci); s2 CHAR(5) COLLATE latin1_swedish_ci);
@ -1849,11 +1849,11 @@ drop table t1, t2;
create table t1 (s1 int); create table t1 (s1 int);
create table t2 (s1 int); create table t2 (s1 int);
select * from t1 where (select count(*) from t2 where t1.s2) = 1; select * from t1 where (select count(*) from t2 where t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'where clause' ERROR 42S22: Unknown column 't1.s2' in 'WHERE'
select * from t1 where (select count(*) from t2 group by t1.s2) = 1; select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
select count(*) from t2 group by t1.s2; select count(*) from t2 group by t1.s2;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB)); CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA)); CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
@ -2655,7 +2655,7 @@ INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,
CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ; CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a'); INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ERROR 42S22: Unknown column 'b.sc' in 'field list' ERROR 42S22: Unknown column 'b.sc' in 'SELECT'
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ac ac
700 700
@ -2746,7 +2746,7 @@ drop table t1;
create table t1 (a1 int); create table t1 (a1 int);
create table t2 (b1 int); create table t2 (b1 int);
select * from t1 where a2 > any(select b1 from t2); select * from t1 where a2 > any(select b1 from t2);
ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY'
select * from t1 where a1 > any(select b1 from t2); select * from t1 where a1 > any(select b1 from t2);
a1 a1
drop table t1,t2; drop table t1,t2;
@ -3668,11 +3668,11 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1); CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause' ERROR 42S22: Unknown column 'no_such_column' in 'WHERE'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
DROP TABLE t1; DROP TABLE t1;
create table t1 (i int, j bigint); create table t1 (i int, j bigint);
insert into t1 values (1, 2), (2, 2), (3, 2); insert into t1 values (1, 2), (2, 2), (3, 2);
@ -4474,11 +4474,11 @@ EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
EXPLAIN EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 t1_outer SELECT a AS out_a, MIN(b) FROM t1 t1_outer
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
@ -5464,7 +5464,7 @@ INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1, EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1 (SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
WHERE t1.a = d1.a; WHERE t1.a = d1.a;
ERROR 42S22: Unknown column 'd1.a' in 'where clause' ERROR 42S22: Unknown column 'd1.a' in 'WHERE'
DROP TABLE t1; DROP TABLE t1;
Set up test tables. Set up test tables.
CREATE TABLE t1 ( CREATE TABLE t1 (

View File

@ -66,12 +66,12 @@ SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1 1
1 1
SELECT (SELECT 1), a; SELECT (SELECT 1), a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
a a
1 1
SELECT 1 FROM (SELECT (SELECT a) b) c; SELECT 1 FROM (SELECT (SELECT a) b) c;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
id id
1 1
@ -88,9 +88,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: PROCEDURE does not support subqueries or stored functions ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1,2,3) = ROW(1,2,3); SELECT (SELECT 1,2,3) = ROW(1,2,3);
(SELECT 1,2,3) = ROW(1,2,3) (SELECT 1,2,3) = ROW(1,2,3)
1 1
@ -373,7 +373,7 @@ Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 /* select#1 */ select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <in_optimizer>(`test`.`t6`.`clinic_uq`,<exists>(<primary_index_lookup>(<cache>(`test`.`t6`.`clinic_uq`) in t7 on PRIMARY))) Note 1003 /* select#1 */ select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <in_optimizer>(`test`.`t6`.`clinic_uq`,<exists>(<primary_index_lookup>(<cache>(`test`.`t6`.`clinic_uq`) in t7 on PRIMARY)))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous ERROR 23000: Column 'a' in SELECT is ambiguous
drop table t1,t2,t3; drop table t1,t2,t3;
CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0'); CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b'); INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
@ -484,9 +484,9 @@ numeropost maxnumrep
43506 2 43506 2
40143 1 40143 1
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b; SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT 1 IN (SELECT 1 FROM t2 HAVING a); SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic); SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic);
mot topic date pseudo mot topic date pseudo
joce 40143 2002-10-22 joce joce 40143 2002-10-22 joce
@ -579,7 +579,7 @@ KEY `pseudo` (`pseudo`,`numeropost`)
SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a; SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list) ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list)
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1) numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test'); INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
@ -1407,7 +1407,7 @@ INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t); UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
ERROR 42S22: Unknown column 't.i' in 'field list' ERROR 42S22: Unknown column 't.i' in 'SET'
select * from t1; select * from t1;
i i
3 3
@ -1611,7 +1611,7 @@ create table t2 (s1 int);
insert into t1 values (1); insert into t1 values (1);
insert into t2 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); update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
ERROR 42S22: Unknown column 'x.s1' in 'field list' ERROR 42S22: Unknown column 'x.s1' in 'SELECT'
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
s2 CHAR(5) COLLATE latin1_swedish_ci); s2 CHAR(5) COLLATE latin1_swedish_ci);
@ -1845,11 +1845,11 @@ drop table t1, t2;
create table t1 (s1 int); create table t1 (s1 int);
create table t2 (s1 int); create table t2 (s1 int);
select * from t1 where (select count(*) from t2 where t1.s2) = 1; select * from t1 where (select count(*) from t2 where t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'where clause' ERROR 42S22: Unknown column 't1.s2' in 'WHERE'
select * from t1 where (select count(*) from t2 group by t1.s2) = 1; select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
select count(*) from t2 group by t1.s2; select count(*) from t2 group by t1.s2;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB)); CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA)); CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
@ -2651,7 +2651,7 @@ INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,
CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ; CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a'); INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ERROR 42S22: Unknown column 'b.sc' in 'field list' ERROR 42S22: Unknown column 'b.sc' in 'SELECT'
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ac ac
700 700
@ -2742,7 +2742,7 @@ drop table t1;
create table t1 (a1 int); create table t1 (a1 int);
create table t2 (b1 int); create table t2 (b1 int);
select * from t1 where a2 > any(select b1 from t2); select * from t1 where a2 > any(select b1 from t2);
ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY'
select * from t1 where a1 > any(select b1 from t2); select * from t1 where a1 > any(select b1 from t2);
a1 a1
drop table t1,t2; drop table t1,t2;
@ -3664,11 +3664,11 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1); CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause' ERROR 42S22: Unknown column 'no_such_column' in 'WHERE'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
DROP TABLE t1; DROP TABLE t1;
create table t1 (i int, j bigint); create table t1 (i int, j bigint);
insert into t1 values (1, 2), (2, 2), (3, 2); insert into t1 values (1, 2), (2, 2), (3, 2);
@ -4470,11 +4470,11 @@ EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
EXPLAIN EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 t1_outer SELECT a AS out_a, MIN(b) FROM t1 t1_outer
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
@ -5460,7 +5460,7 @@ INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1, EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1 (SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
WHERE t1.a = d1.a; WHERE t1.a = d1.a;
ERROR 42S22: Unknown column 'd1.a' in 'where clause' ERROR 42S22: Unknown column 'd1.a' in 'WHERE'
DROP TABLE t1; DROP TABLE t1;
Set up test tables. Set up test tables.
CREATE TABLE t1 ( CREATE TABLE t1 (

View File

@ -69,12 +69,12 @@ SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1 1
1 1
SELECT (SELECT 1), a; SELECT (SELECT 1), a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
a a
1 1
SELECT 1 FROM (SELECT (SELECT a) b) c; SELECT 1 FROM (SELECT (SELECT a) b) c;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
id id
1 1
@ -91,9 +91,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: PROCEDURE does not support subqueries or stored functions ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1,2,3) = ROW(1,2,3); SELECT (SELECT 1,2,3) = ROW(1,2,3);
(SELECT 1,2,3) = ROW(1,2,3) (SELECT 1,2,3) = ROW(1,2,3)
1 1
@ -376,7 +376,7 @@ Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous ERROR 23000: Column 'a' in SELECT is ambiguous
drop table t1,t2,t3; drop table t1,t2,t3;
CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0'); CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b'); INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
@ -487,9 +487,9 @@ numeropost maxnumrep
43506 2 43506 2
40143 1 40143 1
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b; SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT 1 IN (SELECT 1 FROM t2 HAVING a); SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic); SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic);
mot topic date pseudo mot topic date pseudo
joce 40143 2002-10-22 joce joce 40143 2002-10-22 joce
@ -582,7 +582,7 @@ KEY `pseudo` (`pseudo`,`numeropost`)
SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a; SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list) ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list)
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1) numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test'); INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
@ -1410,7 +1410,7 @@ INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t); UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
ERROR 42S22: Unknown column 't.i' in 'field list' ERROR 42S22: Unknown column 't.i' in 'SET'
select * from t1; select * from t1;
i i
3 3
@ -1614,7 +1614,7 @@ create table t2 (s1 int);
insert into t1 values (1); insert into t1 values (1);
insert into t2 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); update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
ERROR 42S22: Unknown column 'x.s1' in 'field list' ERROR 42S22: Unknown column 'x.s1' in 'SELECT'
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
s2 CHAR(5) COLLATE latin1_swedish_ci); s2 CHAR(5) COLLATE latin1_swedish_ci);
@ -1848,11 +1848,11 @@ drop table t1, t2;
create table t1 (s1 int); create table t1 (s1 int);
create table t2 (s1 int); create table t2 (s1 int);
select * from t1 where (select count(*) from t2 where t1.s2) = 1; select * from t1 where (select count(*) from t2 where t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'where clause' ERROR 42S22: Unknown column 't1.s2' in 'WHERE'
select * from t1 where (select count(*) from t2 group by t1.s2) = 1; select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
select count(*) from t2 group by t1.s2; select count(*) from t2 group by t1.s2;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB)); CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA)); CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
@ -2655,7 +2655,7 @@ INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,
CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ; CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a'); INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ERROR 42S22: Unknown column 'b.sc' in 'field list' ERROR 42S22: Unknown column 'b.sc' in 'SELECT'
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ac ac
700 700
@ -2746,7 +2746,7 @@ drop table t1;
create table t1 (a1 int); create table t1 (a1 int);
create table t2 (b1 int); create table t2 (b1 int);
select * from t1 where a2 > any(select b1 from t2); select * from t1 where a2 > any(select b1 from t2);
ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY'
select * from t1 where a1 > any(select b1 from t2); select * from t1 where a1 > any(select b1 from t2);
a1 a1
drop table t1,t2; drop table t1,t2;
@ -3671,11 +3671,11 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1); CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause' ERROR 42S22: Unknown column 'no_such_column' in 'WHERE'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
DROP TABLE t1; DROP TABLE t1;
create table t1 (i int, j bigint); create table t1 (i int, j bigint);
insert into t1 values (1, 2), (2, 2), (3, 2); insert into t1 values (1, 2), (2, 2), (3, 2);
@ -4477,11 +4477,11 @@ EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
EXPLAIN EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 t1_outer SELECT a AS out_a, MIN(b) FROM t1 t1_outer
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
@ -5470,7 +5470,7 @@ INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1, EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1 (SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
WHERE t1.a = d1.a; WHERE t1.a = d1.a;
ERROR 42S22: Unknown column 'd1.a' in 'where clause' ERROR 42S22: Unknown column 'd1.a' in 'WHERE'
DROP TABLE t1; DROP TABLE t1;
Set up test tables. Set up test tables.
CREATE TABLE t1 ( CREATE TABLE t1 (

View File

@ -66,12 +66,12 @@ SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1 1
1 1
SELECT (SELECT 1), a; SELECT (SELECT 1), a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
a a
1 1
SELECT 1 FROM (SELECT (SELECT a) b) c; SELECT 1 FROM (SELECT (SELECT a) b) c;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
id id
1 1
@ -88,9 +88,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: PROCEDURE does not support subqueries or stored functions ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT (SELECT 1,2,3) = ROW(1,2,3); SELECT (SELECT 1,2,3) = ROW(1,2,3);
(SELECT 1,2,3) = ROW(1,2,3) (SELECT 1,2,3) = ROW(1,2,3)
1 1
@ -373,7 +373,7 @@ Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 /* select#1 */ select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(<in_optimizer>(`test`.`t6`.`clinic_uq`,`test`.`t6`.`clinic_uq` in ( <materialize> (/* select#2 */ select `test`.`t7`.`uq` from `test`.`t7` where 1 ), <primary_index_lookup>(`test`.`t6`.`clinic_uq` in <temporary table> on distinct_key where `test`.`t6`.`clinic_uq` = `<subquery2>`.`uq`)))) Note 1003 /* select#1 */ select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(<in_optimizer>(`test`.`t6`.`clinic_uq`,`test`.`t6`.`clinic_uq` in ( <materialize> (/* select#2 */ select `test`.`t7`.`uq` from `test`.`t7` where 1 ), <primary_index_lookup>(`test`.`t6`.`clinic_uq` in <temporary table> on distinct_key where `test`.`t6`.`clinic_uq` = `<subquery2>`.`uq`))))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous ERROR 23000: Column 'a' in SELECT is ambiguous
drop table t1,t2,t3; drop table t1,t2,t3;
CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0'); CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b'); INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
@ -484,9 +484,9 @@ numeropost maxnumrep
43506 2 43506 2
40143 1 40143 1
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b; SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT 1 IN (SELECT 1 FROM t2 HAVING a); SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic); SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic);
mot topic date pseudo mot topic date pseudo
joce 40143 2002-10-22 joce joce 40143 2002-10-22 joce
@ -579,7 +579,7 @@ KEY `pseudo` (`pseudo`,`numeropost`)
SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a; SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list) ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list)
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
ERROR 42S22: Unknown column 'a' in 'having clause' ERROR 42S22: Unknown column 'a' in 'HAVING'
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1) numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test'); INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
@ -1407,7 +1407,7 @@ INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t); UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
ERROR 42S22: Unknown column 't.i' in 'field list' ERROR 42S22: Unknown column 't.i' in 'SET'
select * from t1; select * from t1;
i i
3 3
@ -1611,7 +1611,7 @@ create table t2 (s1 int);
insert into t1 values (1); insert into t1 values (1);
insert into t2 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); update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
ERROR 42S22: Unknown column 'x.s1' in 'field list' ERROR 42S22: Unknown column 'x.s1' in 'SELECT'
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
s2 CHAR(5) COLLATE latin1_swedish_ci); s2 CHAR(5) COLLATE latin1_swedish_ci);
@ -1845,11 +1845,11 @@ drop table t1, t2;
create table t1 (s1 int); create table t1 (s1 int);
create table t2 (s1 int); create table t2 (s1 int);
select * from t1 where (select count(*) from t2 where t1.s2) = 1; select * from t1 where (select count(*) from t2 where t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'where clause' ERROR 42S22: Unknown column 't1.s2' in 'WHERE'
select * from t1 where (select count(*) from t2 group by t1.s2) = 1; select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
select count(*) from t2 group by t1.s2; select count(*) from t2 group by t1.s2;
ERROR 42S22: Unknown column 't1.s2' in 'group statement' ERROR 42S22: Unknown column 't1.s2' in 'GROUP BY'
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB)); CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA)); CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
@ -2651,7 +2651,7 @@ INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,
CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ; CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a'); INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ERROR 42S22: Unknown column 'b.sc' in 'field list' ERROR 42S22: Unknown column 'b.sc' in 'SELECT'
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
ac ac
700 700
@ -2742,7 +2742,7 @@ drop table t1;
create table t1 (a1 int); create table t1 (a1 int);
create table t2 (b1 int); create table t2 (b1 int);
select * from t1 where a2 > any(select b1 from t2); select * from t1 where a2 > any(select b1 from t2);
ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY'
select * from t1 where a1 > any(select b1 from t2); select * from t1 where a1 > any(select b1 from t2);
a1 a1
drop table t1,t2; drop table t1,t2;
@ -3664,11 +3664,11 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1); CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause' ERROR 42S22: Unknown column 'no_such_column' in 'WHERE'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY'
DROP TABLE t1; DROP TABLE t1;
create table t1 (i int, j bigint); create table t1 (i int, j bigint);
insert into t1 values (1, 2), (2, 2), (3, 2); insert into t1 values (1, 2), (2, 2), (3, 2);
@ -4470,11 +4470,11 @@ EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
SELECT a AS out_a, MIN(b) FROM t1 SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a; GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause' ERROR 42S22: Unknown column 'out_a' in 'WHERE'
EXPLAIN EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 t1_outer SELECT a AS out_a, MIN(b) FROM t1 t1_outer
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
@ -5460,7 +5460,7 @@ INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1, EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1 (SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
WHERE t1.a = d1.a; WHERE t1.a = d1.a;
ERROR 42S22: Unknown column 'd1.a' in 'where clause' ERROR 42S22: Unknown column 'd1.a' in 'WHERE'
DROP TABLE t1; DROP TABLE t1;
Set up test tables. Set up test tables.
CREATE TABLE t1 ( CREATE TABLE t1 (

View File

@ -493,7 +493,7 @@ insert into t2 values(1,7503),(2,1);
explain select count(*) explain select count(*)
from t1 from t1
where fid IN (select fid from t2 where (id between 7502 and 8420) order by fid ); where fid IN (select fid from t2 where (id between 7502 and 8420) order by fid );
ERROR 42S22: Unknown column 'fid' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'fid' in 'IN/ALL/ANY'
drop table t1, t2; drop table t1, t2;
create table t1 (a int, b int, key (a), key (b)); create table t1 (a int, b int, key (a), key (b));
insert into t1 values (2,4),(2,4),(2,4); insert into t1 values (2,4),(2,4),(2,4);

View File

@ -506,7 +506,7 @@ insert into t2 values(1,7503),(2,1);
explain select count(*) explain select count(*)
from t1 from t1
where fid IN (select fid from t2 where (id between 7502 and 8420) order by fid ); where fid IN (select fid from t2 where (id between 7502 and 8420) order by fid );
ERROR 42S22: Unknown column 'fid' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'fid' in 'IN/ALL/ANY'
drop table t1, t2; drop table t1, t2;
create table t1 (a int, b int, key (a), key (b)); create table t1 (a int, b int, key (a), key (b));
insert into t1 values (2,4),(2,4),(2,4); insert into t1 values (2,4),(2,4),(2,4);

View File

@ -495,7 +495,7 @@ insert into t2 values(1,7503),(2,1);
explain select count(*) explain select count(*)
from t1 from t1
where fid IN (select fid from t2 where (id between 7502 and 8420) order by fid ); where fid IN (select fid from t2 where (id between 7502 and 8420) order by fid );
ERROR 42S22: Unknown column 'fid' in 'IN/ALL/ANY subquery' ERROR 42S22: Unknown column 'fid' in 'IN/ALL/ANY'
drop table t1, t2; drop table t1, t2;
create table t1 (a int, b int, key (a), key (b)); create table t1 (a int, b int, key (a), key (b));
insert into t1 values (2,4),(2,4),(2,4); insert into t1 values (2,4),(2,4),(2,4);

View File

@ -2456,7 +2456,7 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
Warnings: Warnings:
Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,3) union all /* select#2 */ select 3 AS `3` order by 1 limit 1,2 Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,3) union all /* select#2 */ select 3 AS `3` order by 1 limit 1,2
values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3;
ERROR 42S22: Unknown column '3' in 'order clause' ERROR 42S22: Unknown column '3' in 'ORDER BY'
prepare stmt from " prepare stmt from "
select 2 union (values (5), (7), (1), (3), (4) limit 2) select 2 union (values (5), (7), (1), (3), (4) limit 2)
"; ";
@ -2532,7 +2532,7 @@ deallocate prepare stmt;
prepare stmt from " prepare stmt from "
values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3;
"; ";
ERROR 42S22: Unknown column '3' in 'order clause' ERROR 42S22: Unknown column '3' in 'ORDER BY'
create view v1 as values (5), (7), (1), (3), (4) order by 1 limit 2; create view v1 as values (5), (7), (1), (3), (4) order by 1 limit 2;
show create view v1; show create view v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
@ -2556,12 +2556,12 @@ select * from v1;
3 3
drop view v1; drop view v1;
create view v1 as values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; create view v1 as values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3;
ERROR 42S22: Unknown column '3' in 'order clause' ERROR 42S22: Unknown column '3' in 'ORDER BY'
create view v1 as create view v1 as
( values (5), (7), (1), (3), (4) limit 2 offset 1 ) ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
union union
( values (5), (7), (1), (3), (4) order by 2 limit 2 ); ( values (5), (7), (1), (3), (4) order by 2 limit 2 );
ERROR 42S22: Unknown column '2' in 'order clause' ERROR 42S22: Unknown column '2' in 'ORDER BY'
# #
# MDEV-20229: view defined as select using # MDEV-20229: view defined as select using
# CTE with named columns defined as TVC # CTE with named columns defined as TVC

View File

@ -576,7 +576,7 @@ DROP TABLE t1, t2;
# #
CREATE TEMPORARY TABLE t1 (col1 BIGINT) ENGINE = InnoDB; CREATE TEMPORARY TABLE t1 (col1 BIGINT) ENGINE = InnoDB;
INSERT INTO t1 (no_such_col) SELECT * FROM t1; INSERT INTO t1 (no_such_col) SELECT * FROM t1;
ERROR 42S22: Unknown column 'no_such_col' in 'field list' ERROR 42S22: Unknown column 'no_such_col' in 'INSERT INTO'
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
ALTER TABLE t1 CHANGE no_such_col1 col1 BIGINT NULL; ALTER TABLE t1 CHANGE no_such_col1 col1 BIGINT NULL;
ERROR 42S22: Unknown column 'no_such_col1' in 't1' ERROR 42S22: Unknown column 'no_such_col1' in 't1'

View File

@ -80,7 +80,7 @@ a b
2 b 2 b
1 a 1 a
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b; (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
ERROR 42000: Table 't1' from one of the SELECTs cannot be used in order clause ERROR 42000: Table 't1' from one of the SELECTs cannot be used in ORDER BY
explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc; explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00
@ -115,7 +115,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 UNION t2 ALL NULL NULL NULL NULL 4 2 UNION t2 ALL NULL NULL NULL NULL 4
explain select xx from t1 union select 1; explain select xx from t1 union select 1;
ERROR 42S22: Unknown column 'xx' in 'field list' ERROR 42S22: Unknown column 'xx' in 'SELECT'
explain select a,b from t1 union select 1; explain select a,b from t1 union select 1;
ERROR 21000: The used SELECT statements have a different number of columns ERROR 21000: The used SELECT statements have a different number of columns
explain select 1 union select a,b from t1 union select 1; explain select 1 union select a,b from t1 union select 1;
@ -148,13 +148,13 @@ select 1 as a,(select a union select a);
a (select a union select a) a (select a union select a)
1 1 1 1
(select 1) union (select 2) order by 0; (select 1) union (select 2) order by 0;
ERROR 42S22: Unknown column '0' in 'order clause' ERROR 42S22: Unknown column '0' in 'ORDER BY'
SELECT @a:=1 UNION SELECT @a:=@a+1; SELECT @a:=1 UNION SELECT @a:=@a+1;
@a:=1 @a:=1
1 1
2 2
(SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a); (SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a);
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
(SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2); (SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2);
1 3 1 3
1 3 1 3
@ -493,7 +493,7 @@ drop temporary table t1;
create table t1 select a from t1 union select a from t2; create table t1 select a from t1 union select a from t2;
ERROR 42S01: Table 't1' already exists ERROR 42S01: Table 't1' already exists
select a from t1 union select a from t2 order by t2.a; select a from t1 union select a from t2 order by t2.a;
ERROR 42000: Table 't2' from one of the SELECTs cannot be used in order clause ERROR 42000: Table 't2' from one of the SELECTs cannot be used in ORDER BY
drop table t1,t2; drop table t1,t2;
select length(version()) > 1 as `*` UNION select 2; select length(version()) > 1 as `*` UNION select 2;
* *
@ -1029,7 +1029,7 @@ set sql_select_limit=default;
CREATE TABLE t1 (i int(11) default NULL,c char(1) default NULL,KEY i (i)); CREATE TABLE t1 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
CREATE TABLE t2 (i int(11) default NULL,c char(1) default NULL,KEY i (i)); CREATE TABLE t2 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
explain (select * from t1) union (select * from t2) order by not_existing_column; explain (select * from t1) union (select * from t2) order by not_existing_column;
ERROR 42S22: Unknown column 'not_existing_column' in 'order clause' ERROR 42S22: Unknown column 'not_existing_column' in 'ORDER BY'
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (uid int(1)); CREATE TABLE t1 (uid int(1));
INSERT INTO t1 SELECT 150; INSERT INTO t1 SELECT 150;
@ -1529,7 +1529,7 @@ a
3 3
4 4
SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test; SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test;
ERROR 42S22: Unknown column 'c' in 'order clause' ERROR 42S22: Unknown column 'c' in 'ORDER BY'
DROP TABLE t1; DROP TABLE t1;
(select 1 into @var) union (select 1); (select 1 into @var) union (select 1);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'into @var) union (select 1)' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'into @var) union (select 1)' at line 1

View File

@ -5,11 +5,11 @@ update t1 set a=a+10 where a > 34;
update t1 set a=a+100 where a > 0; update t1 set a=a+100 where a > 0;
update t1 set a=a+100 where a=1 and a=2; update t1 set a=a+100 where a=1 and a=2;
update t1 set a=b+100 where a=1 and a=2; update t1 set a=b+100 where a=1 and a=2;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SET'
update t1 set a=b+100 where c=1 and a=2; update t1 set a=b+100 where c=1 and a=2;
ERROR 42S22: Unknown column 'c' in 'where clause' ERROR 42S22: Unknown column 'c' in 'WHERE'
update t1 set d=a+100 where a=1; update t1 set d=a+100 where a=1;
ERROR 42S22: Unknown column 'd' in 'field list' ERROR 42S22: Unknown column 'd' in 'SET'
select * from t1; select * from t1;
a a
101 101
@ -399,7 +399,7 @@ update t1 set `*f2`=1;
drop table t1; drop table t1;
create table t1(f1 int); create table t1(f1 int);
update t1 set f2=1 order by f2; update t1 set f2=1 order by f2;
ERROR 42S22: Unknown column 'f2' in 'order clause' ERROR 42S22: Unknown column 'f2' in 'ORDER BY'
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
request_id int unsigned NOT NULL auto_increment, request_id int unsigned NOT NULL auto_increment,

View File

@ -1199,7 +1199,7 @@ create table t1 (c1 integer) engine=InnoDb;
create table t2 (c1 integer) engine=InnoDb; create table t2 (c1 integer) engine=InnoDb;
create view v1 as select t1.c1 as "t1c1" ,t2.c1 as "t2c1" from t1,t2 where t1.c1=t2.c1; create view v1 as select t1.c1 as "t1c1" ,t2.c1 as "t2c1" from t1,t2 where t1.c1=t2.c1;
update v1 set t1c1=2 order by 1; update v1 set t1c1=2 order by 1;
ERROR 42S22: Unknown column '1' in 'order clause' ERROR 42S22: Unknown column '1' in 'ORDER BY'
update v1 set t1c1=2 limit 1; update v1 set t1c1=2 limit 1;
drop table t1; drop table t1;
drop table t2; drop table t2;

View File

@ -1,5 +1,5 @@
set @a := foo; set @a := foo;
ERROR 42S22: Unknown column 'foo' in 'field list' ERROR 42S22: Unknown column 'foo' in 'SET'
set @a := connection_id() + 3; set @a := connection_id() + 3;
select @a - connection_id(); select @a - connection_id();
@a - connection_id() @a - connection_id()

View File

@ -73,7 +73,7 @@ drop table t1;
select x'hello'; select x'hello';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'x'hello'' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'x'hello'' at line 1
select 0xfg; select 0xfg;
ERROR 42S22: Unknown column '0xfg' in 'field list' ERROR 42S22: Unknown column '0xfg' in 'SELECT'
create table t1 select 1 as x, 2 as xx; create table t1 select 1 as x, 2 as xx;
select x,xx from t1; select x,xx from t1;
x xx x xx
@ -178,6 +178,6 @@ x'' 0+x''
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: ''
select 0x; select 0x;
ERROR 42S22: Unknown column '0x' in 'field list' ERROR 42S22: Unknown column '0x' in 'SELECT'
select 0b; select 0b;
ERROR 42S22: Unknown column '0b' in 'field list' ERROR 42S22: Unknown column '0b' in 'SELECT'

View File

@ -1765,7 +1765,7 @@ ERROR HY000: Unknown collation: '2048'
set session rand_seed1=DEFAULT; set session rand_seed1=DEFAULT;
ERROR 42000: Variable 'rand_seed1' doesn't have a default value ERROR 42000: Variable 'rand_seed1' doesn't have a default value
set autocommit = value(v); set autocommit = value(v);
ERROR 42S22: Unknown column 'v' in 'field list' ERROR 42S22: Unknown column 'v' in 'SET'
set session sql_mode=ansi_quotes; set session sql_mode=ansi_quotes;
select * from information_schema.session_variables where variable_name='sql_mode'; select * from information_schema.session_variables where variable_name='sql_mode';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE

View File

@ -43,13 +43,13 @@ show create view t1;
ERROR HY000: 'test.t1' is not of type 'VIEW' ERROR HY000: 'test.t1' is not of type 'VIEW'
drop table t1; drop table t1;
select a from v1; select a from v1;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
select v1.a from v1; select v1.a from v1;
ERROR 42S22: Unknown column 'v1.a' in 'field list' ERROR 42S22: Unknown column 'v1.a' in 'SELECT'
select b from v1; select b from v1;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
select v1.b from v1; select v1.b from v1;
ERROR 42S22: Unknown column 'v1.b' in 'field list' ERROR 42S22: Unknown column 'v1.b' in 'SELECT'
explain extended select c from v1; explain extended select c from v1;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
@ -73,9 +73,9 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings: Warnings:
Note 1003 /* select#1 */ select `v2`.`c` AS `c` from `test`.`v2` Note 1003 /* select#1 */ select `v2`.`c` AS `c` from `test`.`v2`
create view v3 (c) as select a+1 from v1; create view v3 (c) as select a+1 from v1;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'SELECT'
create view v3 (c) as select b+1 from v1; create view v3 (c) as select b+1 from v1;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'SELECT'
create view v3 (c) as select c+1 from v1; create view v3 (c) as select c+1 from v1;
select c from v3; select c from v3;
c c
@ -1586,7 +1586,7 @@ drop table t1;
create table t1 (s1 int, s2 char); create table t1 (s1 int, s2 char);
create view v1 as select s1, s2 from t1; create view v1 as select s1, s2 from t1;
select s2 from v1 vq1 where 2 = (select count(*) from v1 vq2 having vq1.s2 = vq2.s2); select s2 from v1 vq1 where 2 = (select count(*) from v1 vq2 having vq1.s2 = vq2.s2);
ERROR 42S22: Unknown column 'vq2.s2' in 'having clause' ERROR 42S22: Unknown column 'vq2.s2' in 'HAVING'
select s2 from v1 vq1 where 2 = (select count(*) aa from v1 vq2 having vq1.s2 = aa); select s2 from v1 vq1 where 2 = (select count(*) aa from v1 vq2 having vq1.s2 = aa);
s2 s2
drop view v1; drop view v1;
@ -2512,7 +2512,7 @@ blank
not blank not blank
not blank not blank
Warnings: Warnings:
Warning 1052 Column 'x' in group statement is ambiguous Warning 1052 Column 'x' in GROUP BY is ambiguous
SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1; SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1;
x x
blank blank
@ -2529,7 +2529,7 @@ blank
not blank not blank
not blank not blank
Warnings: Warnings:
Warning 1052 Column 'x' in group statement is ambiguous Warning 1052 Column 'x' in GROUP BY is ambiguous
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
drop table if exists t1; drop table if exists t1;
@ -6021,7 +6021,7 @@ f1 f2
1 20 1 20
drop table t1, t2; drop table t1, t2;
SELECT 1 FROM (SELECT 1 as a) AS b HAVING (SELECT `SOME_GARBAGE`.b.a)=1; SELECT 1 FROM (SELECT 1 as a) AS b HAVING (SELECT `SOME_GARBAGE`.b.a)=1;
ERROR 42S22: Unknown column 'SOME_GARBAGE.b.a' in 'field list' ERROR 42S22: Unknown column 'SOME_GARBAGE.b.a' in 'SELECT'
# #
# MDEV-10035: DBUG_ASSERT on CREATE VIEW v1 AS SELECT * FROM t1 # MDEV-10035: DBUG_ASSERT on CREATE VIEW v1 AS SELECT * FROM t1
# FOR UPDATE # FOR UPDATE
@ -6936,11 +6936,11 @@ CREATE TABLE t2 (b int);
INSERT INTO t2 VALUES (2),(3); INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (c int); CREATE TABLE t3 (c int);
CREATE VIEW v1 AS SELECT * FROM t1 JOIN t2 ON t1.x > t2.b; CREATE VIEW v1 AS SELECT * FROM t1 JOIN t2 ON t1.x > t2.b;
ERROR 42S22: Unknown column 't1.x' in 'on clause' ERROR 42S22: Unknown column 't1.x' in 'ON'
INSERT INTO t3 SELECT * FROM t1 JOIN t2 ON t1.x > t2.b; INSERT INTO t3 SELECT * FROM t1 JOIN t2 ON t1.x > t2.b;
ERROR 42S22: Unknown column 't1.x' in 'on clause' ERROR 42S22: Unknown column 't1.x' in 'ON'
CREATE TABLE t4 AS SELECT * FROM t1 JOIN t2 ON t1.x > t2.b; CREATE TABLE t4 AS SELECT * FROM t1 JOIN t2 ON t1.x > t2.b;
ERROR 42S22: Unknown column 't1.x' in 'on clause' ERROR 42S22: Unknown column 't1.x' in 'ON'
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
# #
# MDEV-29088: view specification contains unknown column in ON condition # MDEV-29088: view specification contains unknown column in ON condition
@ -6950,10 +6950,10 @@ create table t2 (b int);
create table t3 (c int); create table t3 (c int);
create view v as create view v as
select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3); select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3);
ERROR 42S22: Unknown column 'd' in 'field list' ERROR 42S22: Unknown column 'd' in 'SELECT'
create algorithm=merge view v as create algorithm=merge view v as
select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3); select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3);
ERROR 42S22: Unknown column 'd' in 'field list' ERROR 42S22: Unknown column 'd' in 'SELECT'
drop table t1,t2,t3; drop table t1,t2,t3;
# #
# MDEV-31189: Server crash or assertion failure in upon 2nd # MDEV-31189: Server crash or assertion failure in upon 2nd

View File

@ -42,7 +42,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings: Warnings:
Note 1003 /* select#1 */ select "test"."t1"."a" AS "a","__2"."b" AS "b" from "test"."t1" join (/* select#2 */ select max("test"."t2"."a") AS "b" from "test"."t2") "__2" Note 1003 /* select#1 */ select "test"."t1"."a" AS "a","__2"."b" AS "b" from "test"."t1" join (/* select#2 */ select max("test"."t2"."a") AS "b" from "test"."t2") "__2"
select * from (select tt.* from (select * from t1) as tt) where tt.a > 0; select * from (select tt.* from (select * from t1) as tt) where tt.a > 0;
ERROR 42S22: Unknown column 'tt.a' in 'where clause' ERROR 42S22: Unknown column 'tt.a' in 'WHERE'
select * from (select tt.* from (select * from t1) as tt) where a > 0; select * from (select tt.* from (select * from t1) as tt) where a > 0;
a a
2 2

View File

@ -6,9 +6,9 @@ SET sql_mode=ORACLE;
# Using SQLCODE and SQLERRM outside of an SP # Using SQLCODE and SQLERRM outside of an SP
# #
SELECT SQLCODE; SELECT SQLCODE;
ERROR 42S22: Unknown column 'SQLCODE' in 'field list' ERROR 42S22: Unknown column 'SQLCODE' in 'SELECT'
SELECT SQLERRM; SELECT SQLERRM;
ERROR 42S22: Unknown column 'SQLERRM' in 'field list' ERROR 42S22: Unknown column 'SQLERRM' in 'SELECT'
CREATE TABLE t1 (SQLCODE INT, SQLERRM VARCHAR(10)); CREATE TABLE t1 (SQLCODE INT, SQLERRM VARCHAR(10));
INSERT INTO t1 VALUES (10, 'test'); INSERT INTO t1 VALUES (10, 'test');
SELECT SQLCODE, SQLERRM FROM t1; SELECT SQLCODE, SQLERRM FROM t1;

View File

@ -186,9 +186,9 @@ ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
PREPARE stmt FROM (SELECT 'SELECT 1'); PREPARE stmt FROM (SELECT 'SELECT 1');
ERROR 42000: PREPARE..FROM does not support subqueries or stored functions ERROR 42000: PREPARE..FROM does not support subqueries or stored functions
EXECUTE IMMEDIATE a; EXECUTE IMMEDIATE a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'EXECUTE IMMEDIATE'
PREPARE stmt FROM a; PREPARE stmt FROM a;
ERROR 42S22: Unknown column 'a' in 'field list' ERROR 42S22: Unknown column 'a' in 'PREPARE..FROM'
EXECUTE IMMEDIATE NULL; EXECUTE IMMEDIATE NULL;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1
PREPARE stmt FROM NULL; PREPARE stmt FROM NULL;

View File

@ -1200,7 +1200,7 @@ END LOOP;
END; END;
$$ $$
CALL p1; CALL p1;
ERROR 42S22: Unknown column 'rec' in 'field list' ERROR 42S22: Unknown column 'rec' in 'SELECT'
DROP PROCEDURE p1; DROP PROCEDURE p1;
CREATE PROCEDURE p1 AS CREATE PROCEDURE p1 AS
BEGIN BEGIN
@ -1211,7 +1211,7 @@ END LOOP;
END; END;
$$ $$
CALL p1; CALL p1;
ERROR 42S02: Unknown table 'rec' in field list ERROR 42S02: Unknown table 'rec' in SELECT
DROP PROCEDURE p1; DROP PROCEDURE p1;
# Totally confusing name mixture # Totally confusing name mixture
CREATE TABLE rec (rec INT); CREATE TABLE rec (rec INT);

View File

@ -2450,7 +2450,7 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
Warnings: Warnings:
Note 1003 (/* select#1 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 1,3) union all /* select#2 */ select 3 AS "3" order by 1 limit 1,2 Note 1003 (/* select#1 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 1,3) union all /* select#2 */ select 3 AS "3" order by 1 limit 1,2
values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3;
ERROR 42S22: Unknown column '3' in 'order clause' ERROR 42S22: Unknown column '3' in 'ORDER BY'
create view v1 as values (5), (7), (1), (3), (4) order by 1 limit 2; create view v1 as values (5), (7), (1), (3), (4) order by 1 limit 2;
show create view v1; show create view v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
@ -2474,9 +2474,9 @@ select * from v1;
3 3
drop view v1; drop view v1;
create view v1 as values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; create view v1 as values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3;
ERROR 42S22: Unknown column '3' in 'order clause' ERROR 42S22: Unknown column '3' in 'ORDER BY'
create view v1 as create view v1 as
( values (5), (7), (1), (3), (4) limit 2 offset 1 ) ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
union union
( values (5), (7), (1), (3), (4) order by 2 limit 2 ); ( values (5), (7), (1), (3), (4) order by 2 limit 2 );
ERROR 42S22: Unknown column '2' in 'order clause' ERROR 42S22: Unknown column '2' in 'ORDER BY'

View File

@ -4209,14 +4209,14 @@ Create view v1_1
as Select test.tb2.f59 as NewNameF1, test.tb2.f60 as NewNameF2 as Select test.tb2.f59 as NewNameF1, test.tb2.f60 as NewNameF2
from tb2 limit 0,100 ; from tb2 limit 0,100 ;
SELECT NewNameF1,f60 FROM test.v1_1 ; SELECT NewNameF1,f60 FROM test.v1_1 ;
ERROR 42S22: Unknown column 'f60' in 'field list' ERROR 42S22: Unknown column 'f60' in 'SELECT'
SELECT NewNameF1, v1_1.f60 FROM test.v1_1 ; SELECT NewNameF1, v1_1.f60 FROM test.v1_1 ;
ERROR 42S22: Unknown column 'v1_1.f60' in 'field list' ERROR 42S22: Unknown column 'v1_1.f60' in 'SELECT'
SELECT f59, f60 FROM test.v1 ; SELECT f59, f60 FROM test.v1 ;
ERROR 42S22: Unknown column 'f59' in 'field list' ERROR 42S22: Unknown column 'f59' in 'SELECT'
Use test ; Use test ;
SELECT F59 FROM v1 ; SELECT F59 FROM v1 ;
ERROR 42S22: Unknown column 'F59' in 'field list' ERROR 42S22: Unknown column 'F59' in 'SELECT'
Testcase 3.3.1.19 Testcase 3.3.1.19
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -22453,7 +22453,7 @@ INSERT INTO t1 SET f1 = 0, f4x = 'ABC', report = 't1 1';
INSERT INTO v1 SET f1 = 0, f4 = 'ABC', report = 'v1 1'; INSERT INTO v1 SET f1 = 0, f4 = 'ABC', report = 'v1 1';
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
INSERT INTO v1 SET f1 = 0, f4x = 'ABC', report = 'v1 1a'; INSERT INTO v1 SET f1 = 0, f4x = 'ABC', report = 'v1 1a';
ERROR 42S22: Unknown column 'f4x' in 'field list' ERROR 42S22: Unknown column 'f4x' in 'INSERT INTO'
INSERT INTO v1 SET f1 = 0, report = 'v1 1b'; INSERT INTO v1 SET f1 = 0, report = 'v1 1b';
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
DESCRIBE t1; DESCRIBE t1;
@ -22756,7 +22756,7 @@ INSERT INTO t1 SET f1 = 'ABC', f2 = -3.3E-4,
f3 = -2.2, f4 = '<------ 20 -------->', report = 't1 9'; f3 = -2.2, f4 = '<------ 20 -------->', report = 't1 9';
INSERT INTO v1 SET f1 = 'ABC', f2 = -3.3E-4, INSERT INTO v1 SET f1 = 'ABC', f2 = -3.3E-4,
f3 = -2.2, f4 = '<------ 20 -------->', report = 'v1 9'; f3 = -2.2, f4 = '<------ 20 -------->', report = 'v1 9';
ERROR 42S22: Unknown column 'f3' in 'field list' ERROR 42S22: Unknown column 'f3' in 'INSERT INTO'
INSERT INTO v1 SET f1 = 'ABC', f2 = -3.3E-4, INSERT INTO v1 SET f1 = 'ABC', f2 = -3.3E-4,
f4 = '<------ 20 -------->', report = 'v1 9a'; f4 = '<------ 20 -------->', report = 'v1 9a';
DESCRIBE t1; DESCRIBE t1;

Some files were not shown because too many files have changed in this diff Show More