summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2002-11-29 15:22:47 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2002-11-29 15:22:47 +0200
commit66e3b9d7e66a89b73c8e13ee76dbfcaf47098034 (patch)
tree8c28fa812c9913c1cfeb3c2d0e52df0f97c0cfcc /mysql-test
parentb226e15a096ad9493162f2d8dc81e40c69f848c7 (diff)
parent1b921a995e3defb62aa51fc09fc4eaed9b0f4eab (diff)
downloadmariadb-git-66e3b9d7e66a89b73c8e13ee76dbfcaf47098034.tar.gz
many, many changes
mysql-test/r/subselect.result: Auto merged sql/sql_base.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_parse.cc: Auto merged include/mysqld_error.h: Merging changes ... mysql-test/t/subselect.test: Merging changes ... sql/share/czech/errmsg.txt: Merging changes ... sql/share/danish/errmsg.txt: Merging changes ... sql/share/dutch/errmsg.txt: Merging changes ... sql/share/english/errmsg.txt: Merging changes ... sql/share/estonian/errmsg.txt: Merging changes ... sql/share/french/errmsg.txt: Merging changes ... sql/share/german/errmsg.txt: Merging changes ... sql/share/greek/errmsg.txt: Merging changes ... sql/share/hungarian/errmsg.txt: Merging changes ... sql/share/italian/errmsg.txt: Merging changes ... sql/share/japanese/errmsg.txt: Merging changes ... sql/share/korean/errmsg.txt: Merging changes ... sql/share/norwegian-ny/errmsg.txt: Merging changes ... sql/share/norwegian/errmsg.txt: Merging changes ... sql/share/polish/errmsg.txt: Merging changes ... sql/share/portuguese/errmsg.txt: Merging changes ... sql/share/romanian/errmsg.txt: Merging changes ... sql/share/russian/errmsg.txt: Merging changes ... sql/share/serbian/errmsg.txt: Merging changes ... sql/share/slovak/errmsg.txt: Merging changes ... sql/share/spanish/errmsg.txt: Merging changes ... sql/share/swedish/errmsg.txt: Merging changes ... sql/share/ukrainian/errmsg.txt: Merging changes ...
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/derived.result30
-rw-r--r--mysql-test/r/group_by.result2
-rw-r--r--mysql-test/r/select_found.result2
-rw-r--r--mysql-test/r/subselect.result20
-rw-r--r--mysql-test/t/derived.test24
-rw-r--r--mysql-test/t/group_by.test2
-rw-r--r--mysql-test/t/select_found.test2
-rw-r--r--mysql-test/t/subselect.test20
8 files changed, 55 insertions, 47 deletions
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index b397c2f7635..0dce2b50819 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -17,32 +17,32 @@ select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3
a y
3 3
3 3
-SELECT a FROM (SELECT 1 FROM (SELECT 1) HAVING a=1);
+SELECT a FROM (SELECT 1 FROM (SELECT 1) a HAVING a=1) b;
Unknown column 'a' in 'having clause'
-SELECT a,b as a FROM (SELECT '1' as a,'2' as b) HAVING a=1;
+SELECT a,b as a FROM (SELECT '1' as a,'2' as b) b HAVING a=1;
Column: 'a' in having clause is ambiguous
-SELECT a,2 as a FROM (SELECT '1' as a) HAVING a=2;
+SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=2;
a a
1 2
-SELECT a,2 as a FROM (SELECT '1' as a) HAVING a=1;
+SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=1;
a a
-SELECT 1 FROM (SELECT 1) WHERE a=2;
+SELECT 1 FROM (SELECT 1) a WHERE a=2;
Unknown column 'a' in 'where clause'
-SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1);
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) as a;
Unknown column 'a' in 'having clause'
drop table if exists t1.t2,t3;
-select * from (select 1);
+select * from (select 1) as a;
1
1
-select a from (select 1 as a);
+select a from (select 1 as a) as b;
a
1
-select 1 from (select 1);
+select 1 from (select 1) as a;
1
1
drop table if exists t1;
create table t1(a int not null, t char(8), index(a));
-SELECT * FROM (SELECT * FROM t1) ORDER BY a ASC LIMIT 0,20;
+SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20;
a t
1 1
2 2
@@ -64,7 +64,13 @@ a t
18 18
19 19
20 20
+explain select count(*) from t1 as tt1, (select * from t1) as tt2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE Select tables optimized away
drop table if exists t1;
-SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a)));
-(SELECT * FROM (SELECT 1 as a))
+SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
+(SELECT * FROM (SELECT 1 as a) as a )
1
+select * from (select 1 as a) b left join (select 2 as a) c using(a);
+a a
+1 NULL
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index ead9935f824..b5a35b981db 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1,4 +1,4 @@
-SELECT 1 FROM (SELECT 1) GROUP BY SUM(1);
+SELECT 1 FROM (SELECT 1) as a GROUP BY SUM(1);
Invalid use of group function
drop table if exists t1,t2,t3;
CREATE TABLE t1 (
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index 8500e244d08..5b6c490b928 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -168,7 +168,7 @@ test2 2 2
SELECT FOUND_ROWS();
FOUND_ROWS()
2
-SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) LIMIT 0;
+SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) as a LIMIT 0;
1
SELECT FOUND_ROWS();
FOUND_ROWS()
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index bbf70150ee0..65221ab3f4b 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -8,29 +8,29 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2);
SELECT (SELECT (SELECT 0 UNION SELECT 0));
(SELECT (SELECT 0 UNION SELECT 0))
0
-SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a;
+SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
Reference 'a' not supported (forward reference in item list)
-SELECT (SELECT 1 FROM (SELECT 1) HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) HAVING a=1) as b;
+SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
Reference 'b' not supported (forward reference in item list)
-SELECT (SELECT 1),MAX(1) FROM (SELECT 1);
+SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
(SELECT 1) MAX(1)
1 1
SELECT (SELECT a) as a;
Reference 'a' not supported (forward reference in item list)
-EXPLAIN SELECT 1 FROM (SELECT 1 as a) HAVING (SELECT a)=1;
+EXPLAIN SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
3 DEPENDENT SUBSELECT No tables used
2 DERIVED No tables used
-SELECT 1 FROM (SELECT 1 as a) HAVING (SELECT a)=1;
+SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
SELECT (SELECT 1), a;
Unknown column 'a' in 'field list'
-SELECT 1 as a FROM (SELECT 1) HAVING (SELECT a)=1;
+SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
a
1
-SELECT 1 FROM (SELECT (SELECT a));
+SELECT 1 FROM (SELECT (SELECT a) b) c;
Unknown column 'a' in 'field list'
SELECT * FROM (SELECT 1 as id) WHERE id IN (SELECT * FROM (SELECT 1 as id) ORDER BY id LIMIT 1);
id
@@ -319,7 +319,7 @@ SELECT numeropost,maxnumrep FROM t1 WHERE exists (SELECT 1 FROM t2 WHERE (mot='j
numeropost maxnumrep
43506 2
40143 1
-SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1);
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
Unknown column 'a' in 'having clause'
SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
Unknown column 'a' in 'having clause'
@@ -368,7 +368,7 @@ Subselect returns more than 1 record
drop table t1;
CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
INSERT INTO t1 VALUES ();
-SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) HAVING field='b');
+SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b');
Subselect returns more than 1 record
drop table t1;
CREATE TABLE `t1` (
@@ -398,7 +398,7 @@ id select_type table type possible_keys key key_len ref rows Extra
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
-SELECT 1 FROM (SELECT a FROM t1) HAVING (SELECT a)=1;
+SELECT 1 FROM (SELECT a FROM t1) b HAVING (SELECT b.a)=1;
1
1
drop table t1;
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index c1d8af4074a..5c2d0157f14 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -9,19 +9,19 @@ CREATE TABLE t3 (a int not null, b char (10) not null);
insert into t3 values (3,'f'),(4,'y'),(5,'z'),(6,'c');
select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3.a>3) as t5 where t2.b=t5.b) as t4 where t1.a = t4.y;
--error 1054
-SELECT a FROM (SELECT 1 FROM (SELECT 1) HAVING a=1);
+SELECT a FROM (SELECT 1 FROM (SELECT 1) a HAVING a=1) b;
--error 1052
-SELECT a,b as a FROM (SELECT '1' as a,'2' as b) HAVING a=1;
-SELECT a,2 as a FROM (SELECT '1' as a) HAVING a=2;
-SELECT a,2 as a FROM (SELECT '1' as a) HAVING a=1;
+SELECT a,b as a FROM (SELECT '1' as a,'2' as b) b HAVING a=1;
+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=1;
--error 1054
-SELECT 1 FROM (SELECT 1) WHERE a=2;
+SELECT 1 FROM (SELECT 1) a WHERE a=2;
--error 1054
-SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1);
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) as a;
drop table if exists t1.t2,t3;
-select * from (select 1);
-select a from (select 1 as a);
-select 1 from (select 1);
+select * from (select 1) as a;
+select a from (select 1 as a) as b;
+select 1 from (select 1) as a;
drop table if exists t1;
create table t1(a int not null, t char(8), index(a));
disable_query_log;
@@ -32,6 +32,8 @@ while ($1)
dec $1;
}
enable_query_log;
-SELECT * FROM (SELECT * FROM t1) ORDER BY a ASC LIMIT 0,20;
+SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20;
+explain select count(*) from t1 as tt1, (select * from t1) as tt2;
drop table if exists t1;
-SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a)));
+SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
+select * from (select 1 as a) b left join (select 2 as a) c using(a);
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 0f30fbd4cc6..4670feca500 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1,5 +1,5 @@
-- error 1111
-SELECT 1 FROM (SELECT 1) GROUP BY SUM(1);
+SELECT 1 FROM (SELECT 1) as a GROUP BY SUM(1);
#
# Test of group (Failed for Lars Hoss <lh@pbm.de>)
#
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
index 316e7894344..fb57224dd19 100644
--- a/mysql-test/t/select_found.test
+++ b/mysql-test/t/select_found.test
@@ -84,7 +84,7 @@ INSERT INTO t1 (titre,maxnumrep) VALUES
('test1','1'),('test2','2'),('test3','3');
SELECT SQL_CALC_FOUND_ROWS titre,numeropost,maxnumrep FROM t1 WHERE numeropost IN (1,2) ORDER BY maxnumrep DESC LIMIT 0, 1;
SELECT FOUND_ROWS();
-SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) LIMIT 0;
+SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) as a LIMIT 0;
SELECT FOUND_ROWS();
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE numeropost > 1 LIMIT 0;
SELECT FOUND_ROWS();
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index c875f8372b3..d0d66729374 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -2,25 +2,25 @@ select (select 2);
SELECT (SELECT 1) UNION SELECT (SELECT 2);
SELECT (SELECT (SELECT 0 UNION SELECT 0));
-- error 1245
-SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a;
+SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
-- error 1245
-SELECT (SELECT 1 FROM (SELECT 1) HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) HAVING a=1) as b;
-SELECT (SELECT 1),MAX(1) FROM (SELECT 1);
+SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
+SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
-- error 1245
SELECT (SELECT a) as a;
-EXPLAIN SELECT 1 FROM (SELECT 1 as a) HAVING (SELECT a)=1;
-SELECT 1 FROM (SELECT 1 as a) HAVING (SELECT a)=1;
+EXPLAIN SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
+SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
-- error 1054
SELECT (SELECT 1), a;
-SELECT 1 as a FROM (SELECT 1) HAVING (SELECT a)=1;
+SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
-- error 1054
+SELECT 1 FROM (SELECT (SELECT a) b) c;
SELECT 1 FROM (SELECT (SELECT a));
SELECT * FROM (SELECT 1 as id) WHERE id IN (SELECT * FROM (SELECT 1 as id) ORDER BY id LIMIT 1);
-- error 1239
SELECT * FROM (SELECT 1) WHERE 1 IN (SELECT 1,1);
SELECT 1 IN (SELECT 1);
SELECT 1 FROM (SELECT 1 as a) WHERE 1 IN (SELECT (SELECT a));
-
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
create table t1 (a int);
create table t2 (a int, b int);
@@ -176,7 +176,7 @@ INSERT INTO t2 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce
select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
SELECT numeropost,maxnumrep FROM t1 WHERE exists (SELECT 1 FROM t2 WHERE (mot='joce') AND date >= '2002-10-21' AND t1.numeropost = t2.topic) ORDER BY maxnumrep DESC LIMIT 0, 20;
-- error 1054
-SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1);
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
-- error 1054
SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY date);
@@ -210,7 +210,7 @@ drop table t1;
CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
INSERT INTO t1 VALUES ();
-- error 1240
-SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) HAVING field='b');
+SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b');
drop table t1;
# threadhardwarefr7
@@ -236,7 +236,7 @@ drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
-SELECT 1 FROM (SELECT a FROM t1) HAVING (SELECT a)=1;
+SELECT 1 FROM (SELECT a FROM t1) b HAVING (SELECT b.a)=1;
drop table t1;
#update with subselects