summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorunknown <peter@mysql.com>2002-12-04 16:26:29 +0300
committerunknown <peter@mysql.com>2002-12-04 16:26:29 +0300
commit577cb3238b59ab9f885e9c892d137da3b6c8b599 (patch)
treedd20822cd74c5e54197d66226784622a58842177 /mysql-test/r
parent526ff493bcc374952ca8d66157e48033d21268a1 (diff)
parent265bf238951c3a123c4d6f7fea600175a399cf96 (diff)
downloadmariadb-git-577cb3238b59ab9f885e9c892d137da3b6c8b599.tar.gz
Merge mysql.com:/home/pz/mysql/mysql-4.1-root
into mysql.com:/home/pz/mysql/mysql-4.1 sql/mysql_priv.h: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/insert_update.result51
-rw-r--r--mysql-test/r/row_test.result62
-rw-r--r--mysql-test/r/subselect.result14
-rw-r--r--mysql-test/r/union.result2
4 files changed, 91 insertions, 38 deletions
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
new file mode 100644
index 00000000000..8cc79564679
--- /dev/null
+++ b/mysql-test/r/insert_update.result
@@ -0,0 +1,51 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
+INSERT t1 VALUES (1,2,10), (3,4,20);
+INSERT t1 VALUES (5,6,30) ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 20
+5 6 30
+INSERT t1 VALUES (5,7,40) ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 20
+5 6 130
+INSERT t1 VALUES (8,4,50) ON DUPLICATE KEY UPDATE c=c+1000;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 1020
+5 6 130
+INSERT t1 VALUES (1,4,60) ON DUPLICATE KEY UPDATE c=c+10000;
+SELECT * FROM t1;
+a b c
+1 2 10010
+3 4 1020
+5 6 130
+INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE c=c+100000, b=4;
+Duplicate entry '4' for key 2
+SELECT * FROM t1;
+a b c
+1 2 10010
+3 4 1020
+5 6 130
+TRUNCATE TABLE t1;
+INSERT t1 VALUES (1,2,10), (3,4,20);
+INSERT t1 VALUES (5,6,30), (7,4,40), (8,9,60) ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 120
+5 6 30
+8 9 60
+INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 120
+5 0 30
+8 9 60
+DROP TABLE t1;
diff --git a/mysql-test/r/row_test.result b/mysql-test/r/row_test.result
index f5bf9856a60..f6e989789c7 100644
--- a/mysql-test/r/row_test.result
+++ b/mysql-test/r/row_test.result
@@ -1,60 +1,60 @@
-SELECT (1,2,3)=(1,2,3);
-(1,2,3)=(1,2,3)
+SELECT ROW(1,2,3)=ROW(1,2,3);
+ROW(1,2,3)=ROW(1,2,3)
1
-SELECT (2,2,3)=(1+1,2,3);
-(2,2,3)=(1+1,2,3)
+SELECT ROW(2,2,3)=ROW(1+1,2,3);
+ROW(2,2,3)=ROW(1+1,2,3)
1
-SELECT (1,2,3)=(1+1,2,3);
-(1,2,3)=(1+1,2,3)
+SELECT ROW(1,2,3)=ROW(1+1,2,3);
+ROW(1,2,3)=ROW(1+1,2,3)
0
-SELECT (1,2,3)<(1+1,2,3);
-(1,2,3)<(1+1,2,3)
+SELECT ROW(1,2,3)<ROW(1+1,2,3);
+ROW(1,2,3)<ROW(1+1,2,3)
1
-SELECT (1,2,3)>(1+1,2,3);
-(1,2,3)>(1+1,2,3)
+SELECT ROW(1,2,3)>ROW(1+1,2,3);
+ROW(1,2,3)>ROW(1+1,2,3)
0
-SELECT (1,2,3)<=(1+1,2,3);
-(1,2,3)<=(1+1,2,3)
+SELECT ROW(1,2,3)<=ROW(1+1,2,3);
+ROW(1,2,3)<=ROW(1+1,2,3)
1
-SELECT (1,2,3)>=(1+1,2,3);
-(1,2,3)>=(1+1,2,3)
+SELECT ROW(1,2,3)>=ROW(1+1,2,3);
+ROW(1,2,3)>=ROW(1+1,2,3)
0
-SELECT (1,2,3)<>(1+1,2,3);
-(1,2,3)<>(1+1,2,3)
+SELECT ROW(1,2,3)<>ROW(1+1,2,3);
+ROW(1,2,3)<>ROW(1+1,2,3)
1
-SELECT (NULL,2,3)=(NULL,2,3);
-(NULL,2,3)=(NULL,2,3)
+SELECT ROW(NULL,2,3)=ROW(NULL,2,3);
+ROW(NULL,2,3)=ROW(NULL,2,3)
NULL
-SELECT (NULL,2,3)<=>(NULL,2,3);
-(NULL,2,3)<=>(NULL,2,3)
+SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3);
+ROW(NULL,2,3)<=>ROW(NULL,2,3)
1
-SELECT (1,2,(3,4,5))=(1,2,(3,4,5));
-(1,2,(3,4,5))=(1,2,(3,4,5))
+SELECT ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5));
+ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5))
1
-SELECT ('test',2,3.33)=('test',2,3.33);
-('test',2,3.33)=('test',2,3.33)
+SELECT ROW('test',2,3.33)=ROW('test',2,3.33);
+ROW('test',2,3.33)=ROW('test',2,3.33)
1
-SELECT ('test',2,3.33)=('test',2,3.33,4);
+SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4);
Cardinality error (more/less than 3 columns)
drop table if exists t1;
create table t1 ( a int, b int, c int);
insert into t1 values (1,2,3), (2,3,1), (3,2,1);
-select * from t1 where (1,2,3)=(a,b,c);
+select * from t1 where ROW(1,2,3)=ROW(a,b,c);
a b c
1 2 3
-select * from t1 where (0,2,3)=(a,b,c);
+select * from t1 where ROW(0,2,3)=ROW(a,b,c);
a b c
-select * from t1 where (1,2,3)<(a,b,c);
+select * from t1 where ROW(1,2,3)<ROW(a,b,c);
a b c
2 3 1
3 2 1
drop table t1;
-select (1,1);
+select ROW(1,1);
Cardinality error (more/less than 1 columns)
drop table if exists t1;
create table t1 (i int);
-select 1 from t1 where (1,1);
+select 1 from t1 where ROW(1,1);
Cardinality error (more/less than 1 columns)
-select count(*) from t1 order by (1,1);
+select count(*) from t1 order by ROW(1,1);
Cardinality error (more/less than 1 columns)
drop table t1;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 42e9ff7012f..d198575deb5 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -412,7 +412,7 @@ a b
1 11
2 12
update t1 set b= (select b from t1);
-INSERT TABLE 't1' isn't allowed in FROM table list
+You can't specify target table 't1' for update in FROM clause
update t1 set b= (select b from t2);
Subselect returns more than 1 record
update t1 set b= (select b from t2 where t1.a = t2.a);
@@ -435,7 +435,7 @@ select * from t1 where b = (select b from t2 where t1.a = t2.a);
a b
2 12
delete from t1 where b = (select b from t1);
-INSERT TABLE 't1' isn't allowed in FROM table list
+You can't specify target table 't1' for update in FROM clause
delete from t1 where b = (select b from t2);
Subselect returns more than 1 record
delete from t1 where b = (select b from t2 where t1.a = t2.a);
@@ -462,7 +462,7 @@ a b
22 11
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
-INSERT TABLE 't12' isn't allowed in FROM table list
+You can't specify target table 't12' for update in FROM clause
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
Subselect returns more than 1 record
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
@@ -481,7 +481,7 @@ create table t3 (a int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
-INSERT TABLE 't1' isn't allowed in FROM table list
+You can't specify target table 't1' for update in FROM clause
INSERT INTO t1 (x) VALUES ((SELECT a FROM t3));
Subselect returns more than 1 record
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
@@ -502,7 +502,7 @@ x
3
3
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
-INSERT TABLE 't1' isn't allowed in FROM table list
+You can't specify target table 't1' for update in FROM clause
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
select * from t1;
x
@@ -520,7 +520,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
-INSERT TABLE 't1' isn't allowed in FROM table list
+You can't specify target table 't1' for update in FROM clause
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
Subselect returns more than 1 record
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@@ -584,7 +584,7 @@ SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t VALUES ((SELECT * FROM t));
-INSERT TABLE 't' isn't allowed in FROM table list
+You can't specify target table 't' for update in FROM clause
SELECT * FROM t;
id
1
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 0745f082993..02dda58d48f 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -84,6 +84,8 @@ a b
3 c
2 b
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;
+Table 't1' from one of SELECT's can not be used in order clause
explain (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 Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4