diff options
author | unknown <monty@hundin.mysql.fi> | 2002-05-16 18:20:49 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-05-16 18:20:49 +0300 |
commit | 4d094257dbb785d792785e610ab3cdf41eae9b8c (patch) | |
tree | 12de711f3f9d8ad9eee9d28cf71e5487f17315d3 /mysql-test | |
parent | 2618c6963c5bf1349c47ce3af6e55213ea9773f4 (diff) | |
parent | 74d29a07712a0caf57fca62dacfeb14b110beca4 (diff) | |
download | mariadb-git-4d094257dbb785d792785e610ab3cdf41eae9b8c.tar.gz |
merge with 3.23.51
BitKeeper/etc/ignore:
auto-union
BitKeeper/etc/logging_ok:
auto-union
BitKeeper/deleted/.del-mysql_fix_extensions.sh:
Delete: scripts/mysql_fix_extensions.sh
Build-tools/Do-rpm:
Auto merged
Makefile.am:
Auto merged
client/mysqldump.c:
Auto merged
client/mysqltest.c:
Auto merged
extra/resolve_stack_dump.c:
Auto merged
include/my_pthread.h:
Auto merged
include/my_sys.h:
Auto merged
include/mysqld_error.h:
Auto merged
innobase/row/row0ins.c:
Auto merged
innobase/row/row0mysql.c:
Auto merged
innobase/row/row0sel.c:
Auto merged
isam/pack_isam.c:
Auto merged
libmysql/libmysql.c:
Auto merged
mysql-test/r/func_if.result:
Auto merged
mysql-test/t/join.test:
Auto merged
mysys/array.c:
Auto merged
mysys/charset.c:
Auto merged
mysys/default.c:
Auto merged
mysys/hash.c:
Auto merged
mysys/my_thr_init.c:
Auto merged
mysys/raid.cc:
Auto merged
mysql-test/t/type_decimal.test:
Auto merged
sql/hostname.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_timefunc.h:
Auto merged
sql/log.cc:
Auto merged
sql/mini_client.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
strings/Makefile.am:
Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/func_isnull.result | 1 | ||||
-rw-r--r-- | mysql-test/t/func_isnull.test | 10 | ||||
-rw-r--r-- | mysql-test/t/join.test | 1 | ||||
-rw-r--r-- | mysql-test/t/show_check.test | 14 | ||||
-rw-r--r-- | mysql-test/t/type_datetime.test | 20 | ||||
-rw-r--r-- | mysql-test/t/type_decimal.test | 64 |
6 files changed, 110 insertions, 0 deletions
diff --git a/mysql-test/r/func_isnull.result b/mysql-test/r/func_isnull.result new file mode 100644 index 00000000000..deaeaaf71c9 --- /dev/null +++ b/mysql-test/r/func_isnull.result @@ -0,0 +1 @@ +id mydate diff --git a/mysql-test/t/func_isnull.test b/mysql-test/t/func_isnull.test new file mode 100644 index 00000000000..bd3bcd8d04c --- /dev/null +++ b/mysql-test/t/func_isnull.test @@ -0,0 +1,10 @@ +# +# test of ISNULL() +# + +drop table if exists t1; +create table t1 (id int auto_increment primary key not null, mydate date not null); +insert into t1 values (0,"2002-05-01"),(0,"2002-05-01"),(0,"2002-05-01"); +flush tables; +select * from t1 where isnull(to_days(mydate)); +drop table t1; diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 3bd78350267..18006e8fd22 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -120,6 +120,7 @@ CREATE TABLE t2 (d DATE NOT NULL); INSERT INTO t1 (d) VALUES ('2001-08-01'),('0000-00-00'); SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE t2.d IS NULL; SELECT * from t1 WHERE t1.d IS NULL; +SELECT * FROM t1 WHERE 1/0 IS NULL; DROP TABLE t1,t2; # diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 2613fc17866..5e10ebf23a3 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -75,3 +75,17 @@ show create table t1; ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default; show create table t1; drop table t1; + +create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0)); +show columns from t1; +drop table t1; + +# Check auto conversions of types + +create table t1 (c decimal, d double, f float, r real); +show columns from t1; +drop table t1; + +create table t1 (c decimal(3,3), d double(3,3), f float(3,3)); +show columns from t1; +drop table t1; diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index 857937fd90e..a516bc89f99 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -39,3 +39,23 @@ create table t1 (id int, dt datetime); insert into t1 values (1,"2001-08-14 00:00:00"),(2,"2001-08-15 00:00:00"),(3,"2001-08-16 00:00:00"); select * from t1 where dt='2001-08-14 00:00:00' and dt = if(id=1,'2001-08-14 00:00:00','1999-08-15'); drop table t1; + +# +# Test of datetime optimization +# + +CREATE TABLE `t1` ( + `date` datetime NOT NULL default '0000-00-00 00:00:00', + `numfacture` int(6) unsigned NOT NULL default '0', + `expedition` datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`numfacture`), + KEY `date` (`date`), + KEY `expedition` (`expedition`) +) TYPE=MyISAM; + +INSERT INTO t1 (expedition) VALUES ('0001-00-00 00:00:00'); +SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; +INSERT INTO t1 (numfacture,expedition) VALUES ('1212','0001-00-00 00:00:00'); +SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; +EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; +drop table t1; diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 8d4b50eec4d..70b30d455da 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -147,3 +147,67 @@ INSERT INTO t1 VALUES ( '146', '16', '0.0000000000', '1.9000000000', '', '0', '1 select * from t1 where minvalue<=1 and maxvalue>=-1 and datatype_id=16; select * from t1 where minvalue<=-1 and maxvalue>=-1 and datatype_id=16; drop table t1; + +# +# Test of correct handling leading zero and +/- signs +# then values are passed as strings +# Also test overflow handling in this case +# + +create table t1 (a decimal(10,2)); +insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0"); +insert into t1 values ("-.1"),("+.1"),(".1"); +insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001"); +insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11"); +insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11"); +select * from t1; +drop table t1; + +create table t1 (a decimal(10,2) unsigned); +insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0"); +insert into t1 values ("-.1"),("+.1"),(".1"); +insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001"); +insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11"); +insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11"); +select * from t1; +drop table t1; + +create table t1 (a decimal(10,2) zerofill); +insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0"); +insert into t1 values ("-.1"),("+.1"),(".1"); +insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001"); +insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11"); +insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11"); +select * from t1; +drop table t1; + + +create table t1 (a decimal(10,2)); +insert into t1 values (0.0),(-0.0),(+0.0),(01.0),(+01.0),(-01.0); +insert into t1 values (-.1),(+.1),(.1); +insert into t1 values (00000000000001),(+0000000000001),(-0000000000001); +insert into t1 values (+111111111.11),(111111111.11),(-11111111.11); +insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11); +select * from t1; +drop table t1; + +# +# Test correct handling of overflowed decimal values +# + +create table t1 (a decimal); +insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999); +select * from t1; +drop table t1; +create table t1 (a decimal unsigned); +insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999); +select * from t1; +drop table t1; +create table t1 (a decimal zerofill); +insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999); +select * from t1; +drop table t1; +create table t1 (a decimal unsigned zerofill); +insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999); +select * from t1; +drop table t1; |