mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Fix bug #11760 Typo in Item_func_add_time::print() results in NULLs returned
by subtime() in view Item_func_add_time::print() were printing arg[0] instead of arg[1] which results in wrongly created view. Functions addtime() and subtime were affected by this bug. sql/item_timefunc.cc: Fix bug #11760 Typo in Item_func_add_time::print() results in wrongly created view mysql-test/t/view.test: Test case for bug #11760 Typo in Item_func_add_time::print() results in wrongly created view mysql-test/r/view.result: Test case for bug #11760 Typo in Item_func_add_time::print() results in wrongly created view mysql-test/r/date_formats.result: Fixed wrong test result. Affected by bug#11760
This commit is contained in:
parent
f1d5c0489b
commit
c816f29713
4 changed files with 20 additions and 2 deletions
|
@ -434,7 +434,7 @@ explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM",
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
|
||||
Note 1003 select makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'1 1.1.1.000002') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'1 1.1.1.000002') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
|
||||
create table t1 (d date);
|
||||
insert into t1 values ('2004-07-14'),('2005-07-14');
|
||||
select date_format(d,"%d") from t1 order by 1;
|
||||
|
|
|
@ -2016,3 +2016,11 @@ CALL p1();
|
|||
DROP PROCEDURE p1;
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
create table t1(f1 datetime);
|
||||
insert into t1 values('2005.01.01 12:0:0');
|
||||
create view v1 as select f1, subtime(f1, '1:1:1') as sb from t1;
|
||||
select * from v1;
|
||||
f1 sb
|
||||
2005-01-01 12:00:00 2005-01-01 10:58:59
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
|
|
@ -1853,3 +1853,13 @@ CALL p1();
|
|||
DROP PROCEDURE p1;
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #11760 Typo in Item_func_add_time::print() results in NULLs returned
|
||||
# subtime() in view
|
||||
create table t1(f1 datetime);
|
||||
insert into t1 values('2005.01.01 12:0:0');
|
||||
create view v1 as select f1, subtime(f1, '1:1:1') as sb from t1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
|
|
@ -2524,7 +2524,7 @@ void Item_func_add_time::print(String *str)
|
|||
}
|
||||
args[0]->print(str);
|
||||
str->append(',');
|
||||
args[0]->print(str);
|
||||
args[1]->print(str);
|
||||
str->append(')');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue