diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/bigint.result | 21 | ||||
-rw-r--r-- | mysql-test/r/cast.result | 39 | ||||
-rw-r--r-- | mysql-test/r/constraints.result | 16 | ||||
-rw-r--r-- | mysql-test/r/func_time.result | 6 | ||||
-rw-r--r-- | mysql-test/r/innodb-deadlock.result | 20 | ||||
-rw-r--r-- | mysql-test/r/innodb_cache.result | 10 | ||||
-rw-r--r-- | mysql-test/r/null_key.result | 33 | ||||
-rw-r--r-- | mysql-test/t/bigint.test | 8 | ||||
-rw-r--r-- | mysql-test/t/cast.test | 22 | ||||
-rw-r--r-- | mysql-test/t/constraints.test | 21 | ||||
-rw-r--r-- | mysql-test/t/func_time.test | 3 | ||||
-rw-r--r-- | mysql-test/t/innodb-deadlock.test | 38 | ||||
-rw-r--r-- | mysql-test/t/innodb_cache.test | 9 | ||||
-rw-r--r-- | mysql-test/t/null_key.test | 21 |
14 files changed, 237 insertions, 30 deletions
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index f666c5311b8..6afa74d20e2 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -52,24 +52,3 @@ select min(big),max(big),max(big)-1 from t1 group by a; min(big) max(big) max(big)-1 -1 9223372036854775807 9223372036854775806 drop table t1; -select CAST(1-2 AS UNSIGNED); -CAST(1-2 AS UNSIGNED) -18446744073709551615 -select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER); -CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER) --1 -select CONVERT('-1',UNSIGNED); -CONVERT('-1',UNSIGNED) -18446744073709551615 -select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1; -cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1 -18446744073709551611 18446744073709551611 -select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1; -cast(-5 as unsigned) -1 cast(-5 as unsigned) + 1 -18446744073709551610 18446744073709551612 -select ~5, cast(~5 as signed); -~5 cast(~5 as signed) -18446744073709551610 -6 -select cast(5 as unsigned) -6.0; -cast(5 as unsigned) -6.0 --1.0 diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result new file mode 100644 index 00000000000..572b32c171c --- /dev/null +++ b/mysql-test/r/cast.result @@ -0,0 +1,39 @@ +select CAST(1-2 AS UNSIGNED); +CAST(1-2 AS UNSIGNED) +18446744073709551615 +select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER); +CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER) +-1 +select CONVERT('-1',UNSIGNED); +CONVERT('-1',UNSIGNED) +18446744073709551615 +select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1; +cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1 +18446744073709551611 18446744073709551611 +select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1; +cast(-5 as unsigned) -1 cast(-5 as unsigned) + 1 +18446744073709551610 18446744073709551612 +select ~5, cast(~5 as signed); +~5 cast(~5 as signed) +18446744073709551610 -6 +select cast(5 as unsigned) -6.0; +cast(5 as unsigned) -6.0 +-1.0 +select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A"; +cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A" +0 1 +select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME); +cast("2001-1-1" as DATE) cast("2001-1-1" as DATETIME) +2001-1-1 2001-1-1 +select cast("1:2:3" as TIME); +cast("1:2:3" as TIME) +1:2:3 +select cast("2001-1-1" as date) = "2001-01-01"; +cast("2001-1-1" as date) = "2001-01-01" +0 +select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00"; +cast("2001-1-1" as datetime) = "2001-01-01 00:00:00" +0 +select cast("1:2:3" as TIME) = "1:02:03"; +cast("1:2:3" as TIME) = "1:02:03" +0 diff --git a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result new file mode 100644 index 00000000000..3b41e291e0f --- /dev/null +++ b/mysql-test/r/constraints.result @@ -0,0 +1,16 @@ +drop table if exists t1; +create table t1 (a int check (a>0)); +insert into t1 values (1); +insert into t1 values (0); +drop table t1; +create table t1 (a int ,b int, check a>b); +insert into t1 values (1,0); +insert into t1 values (0,1); +drop table t1; +create table t1 (a int ,b int, constraint abc check (a>b)); +insert into t1 values (1,0); +insert into t1 values (0,1); +drop table t1; +create table t1 (a int null); +insert into t1 values (1),(NULL); +drop table t1; diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 4a1012f73bf..2941352c776 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -24,6 +24,12 @@ now()-curdate()*1000000-curtime() select strcmp(current_timestamp(),concat(current_date()," ",current_time())); strcmp(current_timestamp(),concat(current_date()," ",current_time())) 0 +select strcmp(localtime(),concat(current_date()," ",current_time())); +strcmp(localtime(),concat(current_date()," ",current_time())) +0 +select strcmp(localtimestamp(),concat(current_date()," ",current_time())); +strcmp(localtimestamp(),concat(current_date()," ",current_time())) +0 select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"); date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w") January Thursday 2nd 1997 97 01 02 03 04 05 4 diff --git a/mysql-test/r/innodb-deadlock.result b/mysql-test/r/innodb-deadlock.result new file mode 100644 index 00000000000..121bfa8c6cb --- /dev/null +++ b/mysql-test/r/innodb-deadlock.result @@ -0,0 +1,20 @@ +drop table if exists t1; +create table t1 (id integer, x integer) type=INNODB; +insert into t1 values(0, 0); +set autocommit=0; +SELECT * from t1 where id = 0 FOR UPDATE; +id x +0 0 +set autocommit=0; +update t1 set x=2 where id = 0; +update t1 set x=1 where id = 0; +select * from t1; +id x +0 1 +commit; +commit; +select * from t1; +id x +0 2 +commit; +drop table t1; diff --git a/mysql-test/r/innodb_cache.result b/mysql-test/r/innodb_cache.result index eaa030046da..47abcb45fe5 100644 --- a/mysql-test/r/innodb_cache.result +++ b/mysql-test/r/innodb_cache.result @@ -98,3 +98,13 @@ commit; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 +drop table if exists t1; +CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB; +select count(*) from t1; +count(*) +0 +insert into t1 (id) values (0); +select count(*) from t1; +count(*) +1 +drop table t1; diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 85687df411b..484437959a0 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -228,3 +228,36 @@ alter table t1 add key id (id); select * from t1, t2 where t1.id = t2.id; id id drop table t1,t2; +create table t1 ( +id integer, +id2 integer not null, +index (id), +index (id2) +); +insert into t1 values(null,null),(1,1); +select * from t1; +id id2 +NULL 0 +1 1 +select * from t1 where id <=> null; +id id2 +NULL 0 +select * from t1 where id <=> null or id > 0; +id id2 +NULL 0 +1 1 +select * from t1 where id is null or id > 0; +id id2 +NULL 0 +1 1 +select * from t1 where id2 <=> null or id2 > 0; +id id2 +1 1 +select * from t1 where id2 is null or id2 > 0; +id id2 +1 1 +delete from t1 where id <=> NULL; +select * from t1; +id id2 +1 1 +drop table t1; diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 15b35ac7c87..15c61c2c0dc 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -35,11 +35,3 @@ alter table t1 modify big bigint not null; select min(big),max(big),max(big)-1 from t1; select min(big),max(big),max(big)-1 from t1 group by a; drop table t1; - -select CAST(1-2 AS UNSIGNED); -select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER); -select CONVERT('-1',UNSIGNED); -select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1; -select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1; -select ~5, cast(~5 as signed); -select cast(5 as unsigned) -6.0; diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test new file mode 100644 index 00000000000..7a120ef5005 --- /dev/null +++ b/mysql-test/t/cast.test @@ -0,0 +1,22 @@ +# +# Test of cast function +# + +select CAST(1-2 AS UNSIGNED); +select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER); +select CONVERT('-1',UNSIGNED); +select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1; +select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1; +select ~5, cast(~5 as signed); +select cast(5 as unsigned) -6.0; +select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A"; +select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME); +select cast("1:2:3" as TIME); + +# +# The following should be fixed in 4.1 +# + +select cast("2001-1-1" as date) = "2001-01-01"; +select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00"; +select cast("1:2:3" as TIME) = "1:02:03"; diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test new file mode 100644 index 00000000000..8682cdc42a2 --- /dev/null +++ b/mysql-test/t/constraints.test @@ -0,0 +1,21 @@ +# +# Testing of constraints +# Currently MySQL only ignores the syntax. +# +drop table if exists t1; + +create table t1 (a int check (a>0)); +insert into t1 values (1); +insert into t1 values (0); +drop table t1; +create table t1 (a int ,b int, check a>b); +insert into t1 values (1,0); +insert into t1 values (0,1); +drop table t1; +create table t1 (a int ,b int, constraint abc check (a>b)); +insert into t1 values (1,0); +insert into t1 values (0,1); +drop table t1; +create table t1 (a int null); +insert into t1 values (1),(NULL); +drop table t1; diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 2ff57959965..dd589ff2e66 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -12,6 +12,8 @@ select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"), select sec_to_time(time_to_sec('-838:59:59')); select now()-curdate()*1000000-curtime(); select strcmp(current_timestamp(),concat(current_date()," ",current_time())); +select strcmp(localtime(),concat(current_date()," ",current_time())); +select strcmp(localtimestamp(),concat(current_date()," ",current_time())); select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"); select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w")); select dayofmonth("1997-01-02"),dayofmonth(19970323); @@ -164,6 +166,7 @@ select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1; drop table t1; + # # Test problem with TIMESTAMP and BETWEEN # diff --git a/mysql-test/t/innodb-deadlock.test b/mysql-test/t/innodb-deadlock.test new file mode 100644 index 00000000000..bc2839bfb3a --- /dev/null +++ b/mysql-test/t/innodb-deadlock.test @@ -0,0 +1,38 @@ +-- source include/have_innodb.inc + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +drop table if exists t1; + +# +# Testing of FOR UPDATE +# + +connection con1; +create table t1 (id integer, x integer) type=INNODB; +insert into t1 values(0, 0); +set autocommit=0; +SELECT * from t1 where id = 0 FOR UPDATE; + +connection con2; +set autocommit=0; + +# The following query should hang because con1 is locking the page +--send +update t1 set x=2 where id = 0; +--sleep 2; + +connection con1; +update t1 set x=1 where id = 0; +select * from t1; +commit; + +connection con2; +reap; +commit; + +connection con1; +select * from t1; +commit; + +drop table t1; diff --git a/mysql-test/t/innodb_cache.test b/mysql-test/t/innodb_cache.test index 21d30420eaf..9066a5f19ba 100644 --- a/mysql-test/t/innodb_cache.test +++ b/mysql-test/t/innodb_cache.test @@ -47,4 +47,11 @@ select * from t3; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; commit; -show status like "Qcache_queries_in_cache";
\ No newline at end of file +show status like "Qcache_queries_in_cache"; + +drop table if exists t1; +CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB; +select count(*) from t1; +insert into t1 (id) values (0); +select count(*) from t1; +drop table t1; diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test index 3ab8b993f43..b1cbd5cdfb0 100644 --- a/mysql-test/t/null_key.test +++ b/mysql-test/t/null_key.test @@ -135,3 +135,24 @@ select * from t1, t2 where t1.id = t2.id; alter table t1 add key id (id); select * from t1, t2 where t1.id = t2.id; drop table t1,t2; + +# +# Check bug when doing <=> NULL on an indexed null field +# + +create table t1 ( + id integer, + id2 integer not null, + index (id), + index (id2) +); +insert into t1 values(null,null),(1,1); +select * from t1; +select * from t1 where id <=> null; +select * from t1 where id <=> null or id > 0; +select * from t1 where id is null or id > 0; +select * from t1 where id2 <=> null or id2 > 0; +select * from t1 where id2 is null or id2 > 0; +delete from t1 where id <=> NULL; +select * from t1; +drop table t1; |