From 5b54427d7d879a47893885dbfa0466b4bd69aaf1 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 Dec 2002 19:58:05 +0200 Subject: IN with row item without constant optimisation (SCRUM) renamed row item test mysql-test/r/row.result: IN with row item without constant optimisation mysql-test/t/row.test: IN with row item without constant optimisation sql/item_cmpfunc.cc: IN with row item without constant optimisation sql/item_cmpfunc.h: IN with row item without constant optimisation --- mysql-test/r/row.result | 76 ++++++++++++++++++++++++++++++++++++++++++++ mysql-test/r/row_test.result | 60 ---------------------------------- mysql-test/t/row.test | 42 ++++++++++++++++++++++++ mysql-test/t/row_test.test | 36 --------------------- 4 files changed, 118 insertions(+), 96 deletions(-) create mode 100644 mysql-test/r/row.result delete mode 100644 mysql-test/r/row_test.result create mode 100644 mysql-test/t/row.test delete mode 100644 mysql-test/t/row_test.test (limited to 'mysql-test') diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result new file mode 100644 index 00000000000..e5bc5f4abe5 --- /dev/null +++ b/mysql-test/r/row.result @@ -0,0 +1,76 @@ +select row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); +row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)) +1 +select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); +row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)) +0 +SELECT ROW(1,2,3)=ROW(1,2,3); +ROW(1,2,3)=ROW(1,2,3) +1 +SELECT ROW(2,2,3)=ROW(1+1,2,3); +ROW(2,2,3)=ROW(1+1,2,3) +1 +SELECT ROW(1,2,3)=ROW(1+1,2,3); +ROW(1,2,3)=ROW(1+1,2,3) +0 +SELECT ROW(1,2,3)ROW(1+1,2,3); +ROW(1,2,3)>ROW(1+1,2,3) +0 +SELECT ROW(1,2,3)<=ROW(1+1,2,3); +ROW(1,2,3)<=ROW(1+1,2,3) +1 +SELECT ROW(1,2,3)>=ROW(1+1,2,3); +ROW(1,2,3)>=ROW(1+1,2,3) +0 +SELECT ROW(1,2,3)<>ROW(1+1,2,3); +ROW(1,2,3)<>ROW(1+1,2,3) +1 +SELECT ROW(NULL,2,3)=ROW(NULL,2,3); +ROW(NULL,2,3)=ROW(NULL,2,3) +NULL +SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3); +ROW(NULL,2,3)<=>ROW(NULL,2,3) +1 +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 ROW('test',2,3.33)=ROW('test',2,3.33); +ROW('test',2,3.33)=ROW('test',2,3.33) +1 +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 ROW(1,2,3)=ROW(a,b,c); +a b c +1 2 3 +select * from t1 where ROW(0,2,3)=ROW(a,b,c); +a b c +select * from t1 where ROW(1,2,3)ROW(1+1,2,3); -ROW(1,2,3)>ROW(1+1,2,3) -0 -SELECT ROW(1,2,3)<=ROW(1+1,2,3); -ROW(1,2,3)<=ROW(1+1,2,3) -1 -SELECT ROW(1,2,3)>=ROW(1+1,2,3); -ROW(1,2,3)>=ROW(1+1,2,3) -0 -SELECT ROW(1,2,3)<>ROW(1+1,2,3); -ROW(1,2,3)<>ROW(1+1,2,3) -1 -SELECT ROW(NULL,2,3)=ROW(NULL,2,3); -ROW(NULL,2,3)=ROW(NULL,2,3) -NULL -SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3); -ROW(NULL,2,3)<=>ROW(NULL,2,3) -1 -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 ROW('test',2,3.33)=ROW('test',2,3.33); -ROW('test',2,3.33)=ROW('test',2,3.33) -1 -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 ROW(1,2,3)=ROW(a,b,c); -a b c -1 2 3 -select * from t1 where ROW(0,2,3)=ROW(a,b,c); -a b c -select * from t1 where ROW(1,2,3)ROW(1+1,2,3); +SELECT ROW(1,2,3)<=ROW(1+1,2,3); +SELECT ROW(1,2,3)>=ROW(1+1,2,3); +SELECT ROW(1,2,3)<>ROW(1+1,2,3); +SELECT ROW(NULL,2,3)=ROW(NULL,2,3); +SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3); +SELECT ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5)); +SELECT ROW('test',2,3.33)=ROW('test',2,3.33); +-- error 1239 +SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4); +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 ROW(1,2,3)=ROW(a,b,c); +select * from t1 where ROW(0,2,3)=ROW(a,b,c); +select * from t1 where ROW(1,2,3)ROW(1+1,2,3); -SELECT ROW(1,2,3)<=ROW(1+1,2,3); -SELECT ROW(1,2,3)>=ROW(1+1,2,3); -SELECT ROW(1,2,3)<>ROW(1+1,2,3); -SELECT ROW(NULL,2,3)=ROW(NULL,2,3); -SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3); -SELECT ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5)); -SELECT ROW('test',2,3.33)=ROW('test',2,3.33); --- error 1239 -SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4); -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 ROW(1,2,3)=ROW(a,b,c); -select * from t1 where ROW(0,2,3)=ROW(a,b,c); -select * from t1 where ROW(1,2,3) Date: Sun, 8 Dec 2002 03:19:03 +0200 Subject: optimized IN with Rows (SCRUM) NULL with row (IN) cardinality error of row inside row new[] fixed layout mysql-test/r/row.result: test of optimized IN with Rows test of NULL with row test of cardinality error of row inside row mysql-test/t/row.test: test of optimized IN with Rows test of NULL with row test of cardinality error of row inside row sql/item_cmpfunc.cc: optimized IN with Rows NULL with row (IN) cardinality error of row inside row sql/item_cmpfunc.h: optimized IN with Rows NULL with row (IN) cardinality error of row inside row fixed layout sql/sql_list.h: fixed layout new[] --- mysql-test/r/row.result | 76 ++++++++++++++++++++++++++++++++++++++++++------- mysql-test/t/row.test | 25 +++++++++++++--- 2 files changed, 86 insertions(+), 15 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index e5bc5f4abe5..e0b524d9bb2 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -4,6 +4,35 @@ row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)) select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)) 0 +select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3)); +row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3)) +1 +select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3)); +row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3)) +NULL +select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a')); +row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a')) +1 +select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3)); +row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3)) +1 +select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3)); +row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3)) +1 +select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3)); +row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3)) +1 +select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3)); +row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3)) +NULL +select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,4))); +row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,4))) +1 +select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,4)); +Cardinality error (more/less than 2 columns) +select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL))); +row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL))) +NULL SELECT ROW(1,2,3)=ROW(1,2,3); ROW(1,2,3)=ROW(1,2,3) 1 @@ -42,9 +71,20 @@ ROW('test',2,3.33)=ROW('test',2,3.33) 1 SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4); Cardinality error (more/less than 3 columns) +SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33)); +ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33)) +1 +SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3)); +ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3)) +0 +SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL)); +ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL)) +NULL +SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4); +Cardinality error (more/less than 2 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); +insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL); select * from t1 where ROW(1,2,3)=ROW(a,b,c); a b c 1 2 3 @@ -54,16 +94,30 @@ select * from t1 where ROW(1,2,3)