mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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
This commit is contained in:
1
mysql-test/r/func_isnull.result
Normal file
1
mysql-test/r/func_isnull.result
Normal file
@ -0,0 +1 @@
|
||||
id mydate
|
10
mysql-test/t/func_isnull.test
Normal file
10
mysql-test/t/func_isnull.test
Normal file
@ -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;
|
@ -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;
|
||||
|
||||
#
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user