mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge branch '10.5' into 10.6
This commit is contained in:
@ -12,10 +12,7 @@ select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(
|
||||
select period_add("9602",-12),period_diff(199505,"9404") ;
|
||||
|
||||
select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
|
||||
--enable_view_protocol
|
||||
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")) as e1,from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") as e2,from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0 as e3;
|
||||
select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
|
||||
sec_to_time(time_to_sec("0:30:47")/6.21);
|
||||
select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899);
|
||||
@ -27,14 +24,11 @@ select sec_to_time(-9001.1), sec_to_time(-9001.1) / 1,
|
||||
select sec_to_time(90011e-1), sec_to_time(1234567890123e30);
|
||||
select sec_to_time(1234567890123), sec_to_time('99999999999999999999999999999');
|
||||
select now()-curdate()*1000000-curtime();
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
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"));
|
||||
--enable_view_protocol
|
||||
select strcmp(current_timestamp(),concat(current_date()," ",current_time())) as exp;
|
||||
select strcmp(localtime(),concat(current_date()," ",current_time())) as exp;
|
||||
select strcmp(localtimestamp(),concat(current_date()," ",current_time())) as exp;
|
||||
select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w") as exp;
|
||||
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w")) as exp;
|
||||
select dayofmonth("1997-01-02"),dayofmonth(19970323);
|
||||
select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31");
|
||||
select month("2001-02-00"),year("2001-00-00");
|
||||
@ -84,11 +78,8 @@ select time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(199801310000
|
||||
select time_format(010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
||||
select time_format(131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
||||
select time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
|
||||
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
|
||||
--enable_view_protocol
|
||||
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') as exp;
|
||||
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') as exp;
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL 1 MINUTE);
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL 1 HOUR);
|
||||
@ -127,12 +118,9 @@ select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" MINUTE_SECOND);
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE);
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" DAY_HOUR);
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH);
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND);
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE);
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND);
|
||||
--enable_view_protocol
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND) as exp;
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE) as exp;
|
||||
select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND) as exp;
|
||||
select "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
|
||||
select INTERVAL 1 DAY + "1997-12-31";
|
||||
select "1998-01-01 00:00:00" - INTERVAL 1 SECOND;
|
||||
@ -181,21 +169,15 @@ SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
|
||||
#
|
||||
# MySQL Bugs: #12356: DATE_SUB or DATE_ADD incorrectly returns null
|
||||
#
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
|
||||
SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
|
||||
--enable_view_protocol
|
||||
SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE) as exp;
|
||||
SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE) as exp;
|
||||
|
||||
#
|
||||
# Test big intervals (Bug #3498)
|
||||
#
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND;
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND;
|
||||
--disable_view_protocol
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND as exp;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<31 MINUTE;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<20 HOUR;
|
||||
@ -203,7 +185,7 @@ SELECT "1900-01-01 00:00:00" + INTERVAL 1<<20 HOUR;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<38 SECOND;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<33 MINUTE;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<30 HOUR;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND as exp;
|
||||
|
||||
#
|
||||
# Bug #614 (multiple extracts in where)
|
||||
@ -445,12 +427,9 @@ select last_day("1997-12-1")+0.0;
|
||||
# Test SAPDB UTC_% functions. This part is TZ dependant (It is supposed that
|
||||
# TZ variable set to GMT-3
|
||||
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
|
||||
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0;
|
||||
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
|
||||
--enable_view_protocol
|
||||
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0 as exp;
|
||||
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0 as exp;
|
||||
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0 as exp;
|
||||
select strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0;
|
||||
select strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0;
|
||||
select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
|
||||
@ -755,10 +734,7 @@ set time_zone= @@global.time_zone;
|
||||
#
|
||||
|
||||
select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute;
|
||||
--enable_view_protocol
|
||||
select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute as exp;
|
||||
|
||||
#
|
||||
# Bug #21103: DATE column not compared as DATE
|
||||
@ -848,10 +824,7 @@ select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND;
|
||||
|
||||
# show that we treat fractions of seconds correctly (zerofill from right to
|
||||
# six places) even if we left out fields on the left.
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond);
|
||||
--enable_view_protocol
|
||||
select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond) as exp;
|
||||
select date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond);
|
||||
|
||||
|
||||
@ -1092,19 +1065,13 @@ SET timestamp=DEFAULT;
|
||||
|
||||
SELECT UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%m"));
|
||||
SELECT UNIX_TIMESTAMP('2015-06-00');
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
|
||||
--enable_view_protocol
|
||||
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')) as exp;
|
||||
set sql_mode= 'TRADITIONAL';
|
||||
SELECT @@sql_mode;
|
||||
|
||||
SELECT UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%m"));
|
||||
SELECT UNIX_TIMESTAMP('2015-06-00');
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
|
||||
--enable_view_protocol
|
||||
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')) as exp;
|
||||
|
||||
set sql_mode= default;
|
||||
|
||||
@ -1133,10 +1100,7 @@ select time('10 02:03:04') + interval 1 year;
|
||||
# specially constructed queries to reach obscure places in the code
|
||||
# not touched by the more "normal" queries (and to increase the coverage)
|
||||
select cast('131415.123e0' as time);
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04';
|
||||
--enable_view_protocol
|
||||
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04' as exp;
|
||||
select least(time('1:2:3'), '01:02:04', null) div 1;
|
||||
select truncate(least(time('1:2:3'), '01:02:04', null), 6);
|
||||
select cast(least(time('1:2:3'), '01:02:04', null) as decimal(3,1));
|
||||
@ -1173,12 +1137,10 @@ drop table t1;
|
||||
#
|
||||
# lp:731815 Crash/valgrind warning Item::send with 5.1-micro
|
||||
#
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
|
||||
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow');
|
||||
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06'
|
||||
as datetime)), 'UTC', 'Europe/Moscow') as exp;
|
||||
SET timestamp=DEFAULT;
|
||||
--enable_view_protocol
|
||||
|
||||
#
|
||||
# lp:736370 Datetime functions in subquery context cause wrong result and bogus warnings in mysql-5.1-micr
|
||||
@ -1249,13 +1211,10 @@ drop table t1;
|
||||
|
||||
SET timestamp=UNIX_TIMESTAMP('2014-06-01 10:20:30');
|
||||
select greatest(cast("0-0-0" as date), cast("10:20:05" as time));
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00';
|
||||
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01';
|
||||
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05';
|
||||
select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6));
|
||||
--enable_view_protocol
|
||||
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00' as exp;
|
||||
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01' as exp;
|
||||
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05' as exp;
|
||||
select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)) as exp;
|
||||
SET timestamp=DEFAULT;
|
||||
|
||||
select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
|
||||
@ -1854,28 +1813,25 @@ SELECT
|
||||
--echo #
|
||||
--echo # MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*)
|
||||
--echo #
|
||||
#enable after fix MDEV-27871
|
||||
--disable_view_protocol
|
||||
CREATE TABLE t1 (d DATE);
|
||||
INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21');
|
||||
SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1;
|
||||
SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) FROM t1;
|
||||
SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) FROM t1;
|
||||
SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) FROM t1;
|
||||
SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) FROM t1;
|
||||
SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) as exp FROM t1;
|
||||
SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) as exp FROM t1;
|
||||
SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) as exp FROM t1;
|
||||
SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) as exp FROM t1;
|
||||
SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) as exp FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Maximum possible DAY_SECOND values in various formats
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND);
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND);
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND);
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND);
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND) as exp;
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND) as exp;
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND) as exp;
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND) as exp;
|
||||
|
||||
# Out-of-range INTERVAL DAY_SECOND values
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND);
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND);
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND);
|
||||
--disable_view_protocol
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND) as exp;
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND) as exp;
|
||||
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND) as exp;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime
|
||||
@ -1891,7 +1847,7 @@ INSERT INTO t1 VALUES (1, '1970-01-01');
|
||||
SELECT CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR)) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
|
||||
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR)) as exp;
|
||||
|
||||
|
||||
--echo #
|
||||
|
Reference in New Issue
Block a user