2003-11-03 13:01:59 +01:00
|
|
|
|
drop table if exists t1;
|
2009-01-13 23:29:11 +01:00
|
|
|
|
SELECT variable_name, variable_value
|
|
|
|
|
FROM information_schema.global_variables
|
|
|
|
|
WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
|
|
|
|
|
ORDER BY variable_name;
|
|
|
|
|
variable_name variable_value
|
|
|
|
|
DATETIME_FORMAT %Y-%m-%d %H:%i:%s
|
|
|
|
|
DATE_FORMAT %d.%m.%Y
|
|
|
|
|
TIME_FORMAT %H.%i.%s
|
|
|
|
|
SELECT variable_name, variable_value
|
|
|
|
|
FROM information_schema.session_variables
|
|
|
|
|
WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
|
|
|
|
|
ORDER BY variable_name;
|
|
|
|
|
variable_name variable_value
|
|
|
|
|
DATETIME_FORMAT %Y-%m-%d %H:%i:%s
|
|
|
|
|
DATE_FORMAT %d.%m.%Y
|
|
|
|
|
TIME_FORMAT %H.%i.%s
|
2003-11-03 13:01:59 +01:00
|
|
|
|
select str_to_date(concat('15-01-2001',' 2:59:58.999'),
|
|
|
|
|
concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
|
|
|
|
|
str_to_date(concat('15-01-2001',' 2:59:58.999'),
|
|
|
|
|
concat('%d-%m-%Y',' ','%H:%i:%s.%f'))
|
2004-03-15 15:28:21 +01:00
|
|
|
|
2001-01-15 02:59:58.999000
|
2005-03-30 15:00:31 +02:00
|
|
|
|
select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T');
|
|
|
|
|
STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T')
|
|
|
|
|
NULL
|
|
|
|
|
Warnings:
|
2009-09-10 11:18:29 +02:00
|
|
|
|
Warning 1411 Incorrect time value: '22.30.61' for function str_to_date
|
2003-11-03 13:01:59 +01:00
|
|
|
|
create table t1 (date char(30), format char(30) not null);
|
|
|
|
|
insert into t1 values
|
|
|
|
|
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
|
2004-03-15 15:28:21 +01:00
|
|
|
|
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
|
2007-03-23 21:08:31 +01:00
|
|
|
|
('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
|
|
|
|
|
('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
|
2003-11-03 13:01:59 +01:00
|
|
|
|
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
|
|
|
|
|
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
|
|
|
|
|
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
|
|
|
|
|
('2003-01-02 12:11:12.12345 am', '%Y-%m-%d %h:%i:%S.%f%p'),
|
|
|
|
|
('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'),
|
|
|
|
|
('10:20:10', '%H:%i:%s'),
|
|
|
|
|
('10:20:10', '%h:%i:%s.%f'),
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
('10:20:10', '%T'),
|
2003-11-03 13:01:59 +01:00
|
|
|
|
('10:20:10AM', '%h:%i:%s%p'),
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
('10:20:10AM', '%r'),
|
2003-11-03 13:01:59 +01:00
|
|
|
|
('10:20:10.44AM', '%h:%i:%s.%f%p'),
|
|
|
|
|
('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'),
|
|
|
|
|
('15 September 2001', '%d %M %Y'),
|
|
|
|
|
('15 SEPTEMB 2001', '%d %M %Y'),
|
|
|
|
|
('15 MAY 2001', '%d %b %Y'),
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
('15th May 2001', '%D %b %Y'),
|
2003-11-03 13:01:59 +01:00
|
|
|
|
('Sunday 15 MAY 2001', '%W %d %b %Y'),
|
|
|
|
|
('Sund 15 MAY 2001', '%W %d %b %Y'),
|
|
|
|
|
('Tuesday 00 2002', '%W %U %Y'),
|
|
|
|
|
('Thursday 53 1998', '%W %u %Y'),
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
('Sunday 01 2001', '%W %v %x'),
|
|
|
|
|
('Tuesday 52 2001', '%W %V %X'),
|
|
|
|
|
('060 2004', '%j %Y'),
|
|
|
|
|
('4 53 1998', '%w %u %Y'),
|
2003-11-03 13:01:59 +01:00
|
|
|
|
('15-01-2001', '%d-%m-%Y %H:%i:%S'),
|
|
|
|
|
('15-01-20', '%d-%m-%y'),
|
|
|
|
|
('15-2001-1', '%d-%Y-%c');
|
|
|
|
|
select date,format,str_to_date(date, format) as str_to_date from t1;
|
|
|
|
|
date format str_to_date
|
|
|
|
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
2004-03-15 15:28:21 +01:00
|
|
|
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
2007-03-23 21:08:31 +01:00
|
|
|
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
|
|
|
|
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
2003-11-03 13:01:59 +01:00
|
|
|
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
2004-03-15 15:28:21 +01:00
|
|
|
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
|
|
|
|
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
|
|
|
|
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
|
2003-11-03 13:01:59 +01:00
|
|
|
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
|
|
|
|
|
10:20:10 %H:%i:%s 0000-00-00 10:20:10
|
|
|
|
|
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
10:20:10 %T 0000-00-00 10:20:10
|
2003-11-03 13:01:59 +01:00
|
|
|
|
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
10:20:10AM %r 0000-00-00 10:20:10
|
2004-03-15 15:28:21 +01:00
|
|
|
|
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
|
2003-11-03 13:01:59 +01:00
|
|
|
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
|
|
|
|
|
15 September 2001 %d %M %Y 2001-09-15 00:00:00
|
2003-11-20 21:06:25 +01:00
|
|
|
|
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
|
2003-11-03 13:01:59 +01:00
|
|
|
|
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
15th May 2001 %D %b %Y 2001-05-15 00:00:00
|
2003-11-03 13:01:59 +01:00
|
|
|
|
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
|
|
|
|
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
|
|
|
|
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
|
|
|
|
|
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
|
|
|
|
|
Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
|
|
|
|
|
060 2004 %j %Y 2004-02-29 00:00:00
|
|
|
|
|
4 53 1998 %w %u %Y 1998-12-31 00:00:00
|
2003-11-03 13:01:59 +01:00
|
|
|
|
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
|
|
|
|
|
15-01-20 %d-%m-%y 2020-01-15 00:00:00
|
|
|
|
|
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
|
|
|
|
|
select date,format,concat('',str_to_date(date, format)) as con from t1;
|
|
|
|
|
date format con
|
|
|
|
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
2004-03-15 15:28:21 +01:00
|
|
|
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
2007-03-23 21:08:31 +01:00
|
|
|
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
|
|
|
|
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
2003-11-03 13:01:59 +01:00
|
|
|
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
2004-03-15 15:28:21 +01:00
|
|
|
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
|
|
|
|
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
|
|
|
|
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
|
2003-11-03 13:01:59 +01:00
|
|
|
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
|
|
|
|
|
10:20:10 %H:%i:%s 0000-00-00 10:20:10
|
|
|
|
|
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
10:20:10 %T 0000-00-00 10:20:10
|
2003-11-03 13:01:59 +01:00
|
|
|
|
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
10:20:10AM %r 0000-00-00 10:20:10
|
2004-03-15 15:28:21 +01:00
|
|
|
|
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
|
2003-11-03 13:01:59 +01:00
|
|
|
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
|
|
|
|
|
15 September 2001 %d %M %Y 2001-09-15 00:00:00
|
2003-11-20 21:06:25 +01:00
|
|
|
|
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
|
2003-11-03 13:01:59 +01:00
|
|
|
|
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
15th May 2001 %D %b %Y 2001-05-15 00:00:00
|
2003-11-03 13:01:59 +01:00
|
|
|
|
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
|
|
|
|
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
|
|
|
|
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
|
|
|
|
|
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
|
|
|
|
|
Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
|
|
|
|
|
060 2004 %j %Y 2004-02-29 00:00:00
|
|
|
|
|
4 53 1998 %w %u %Y 1998-12-31 00:00:00
|
2003-11-03 13:01:59 +01:00
|
|
|
|
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
|
|
|
|
|
15-01-20 %d-%m-%y 2020-01-15 00:00:00
|
|
|
|
|
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
|
|
|
|
|
select date,format,cast(str_to_date(date, format) as datetime) as datetime from t1;
|
|
|
|
|
date format datetime
|
|
|
|
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
2004-03-15 15:28:21 +01:00
|
|
|
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
2007-03-23 21:08:31 +01:00
|
|
|
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
|
|
|
|
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
2003-11-03 13:01:59 +01:00
|
|
|
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
2011-03-08 19:41:58 +01:00
|
|
|
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12
|
|
|
|
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12
|
|
|
|
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12
|
2003-11-03 13:01:59 +01:00
|
|
|
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
|
2007-02-08 08:56:18 +01:00
|
|
|
|
10:20:10 %H:%i:%s 0000-00-00 10:20:10
|
|
|
|
|
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
|
|
|
|
|
10:20:10 %T 0000-00-00 10:20:10
|
|
|
|
|
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
|
|
|
|
|
10:20:10AM %r 0000-00-00 10:20:10
|
2011-03-08 19:41:58 +01:00
|
|
|
|
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10
|
2003-11-03 13:01:59 +01:00
|
|
|
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
|
|
|
|
|
15 September 2001 %d %M %Y 2001-09-15 00:00:00
|
2003-11-20 21:06:25 +01:00
|
|
|
|
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
|
2003-11-03 13:01:59 +01:00
|
|
|
|
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
15th May 2001 %D %b %Y 2001-05-15 00:00:00
|
2003-11-03 13:01:59 +01:00
|
|
|
|
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
|
|
|
|
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
|
|
|
|
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
|
|
|
|
|
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
|
|
|
|
|
Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
|
|
|
|
|
060 2004 %j %Y 2004-02-29 00:00:00
|
|
|
|
|
4 53 1998 %w %u %Y 1998-12-31 00:00:00
|
2003-11-03 13:01:59 +01:00
|
|
|
|
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
|
|
|
|
|
15-01-20 %d-%m-%y 2020-01-15 00:00:00
|
|
|
|
|
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
|
|
|
|
|
select date,format,DATE(str_to_date(date, format)) as date2 from t1;
|
|
|
|
|
date format date2
|
|
|
|
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02
|
2004-03-15 15:28:21 +01:00
|
|
|
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02
|
2007-03-23 21:08:31 +01:00
|
|
|
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02
|
|
|
|
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02
|
2003-11-03 13:01:59 +01:00
|
|
|
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02
|
|
|
|
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
|
|
|
|
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02
|
|
|
|
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
|
|
|
|
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02
|
|
|
|
|
10:20:10 %H:%i:%s 0000-00-00
|
|
|
|
|
10:20:10 %h:%i:%s.%f 0000-00-00
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
10:20:10 %T 0000-00-00
|
2003-11-03 13:01:59 +01:00
|
|
|
|
10:20:10AM %h:%i:%s%p 0000-00-00
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
10:20:10AM %r 0000-00-00
|
2003-11-03 13:01:59 +01:00
|
|
|
|
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00
|
|
|
|
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15
|
|
|
|
|
15 September 2001 %d %M %Y 2001-09-15
|
2003-11-20 21:06:25 +01:00
|
|
|
|
15 SEPTEMB 2001 %d %M %Y 2001-09-15
|
2003-11-03 13:01:59 +01:00
|
|
|
|
15 MAY 2001 %d %b %Y 2001-05-15
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
15th May 2001 %D %b %Y 2001-05-15
|
2003-11-03 13:01:59 +01:00
|
|
|
|
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15
|
|
|
|
|
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15
|
|
|
|
|
Tuesday 00 2002 %W %U %Y 2002-01-01
|
|
|
|
|
Thursday 53 1998 %W %u %Y 1998-12-31
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
Sunday 01 2001 %W %v %x 2001-01-07
|
|
|
|
|
Tuesday 52 2001 %W %V %X 2002-01-01
|
|
|
|
|
060 2004 %j %Y 2004-02-29
|
|
|
|
|
4 53 1998 %w %u %Y 1998-12-31
|
2003-11-03 13:01:59 +01:00
|
|
|
|
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15
|
|
|
|
|
15-01-20 %d-%m-%y 2020-01-15
|
|
|
|
|
15-2001-1 %d-%Y-%c 2001-01-15
|
|
|
|
|
select date,format,TIME(str_to_date(date, format)) as time from t1;
|
|
|
|
|
date format time
|
2013-09-12 19:31:14 +02:00
|
|
|
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12.000000
|
|
|
|
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02.000000
|
|
|
|
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02.000000
|
|
|
|
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02.000000
|
|
|
|
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12.000000
|
2004-03-15 15:28:21 +01:00
|
|
|
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
|
|
|
|
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
|
|
|
|
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
|
2013-09-12 19:31:14 +02:00
|
|
|
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12.000000
|
|
|
|
|
10:20:10 %H:%i:%s 10:20:10.000000
|
|
|
|
|
10:20:10 %h:%i:%s.%f 10:20:10.000000
|
|
|
|
|
10:20:10 %T 10:20:10.000000
|
|
|
|
|
10:20:10AM %h:%i:%s%p 10:20:10.000000
|
|
|
|
|
10:20:10AM %r 10:20:10.000000
|
2007-02-08 08:56:18 +01:00
|
|
|
|
10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
|
2013-09-12 19:31:14 +02:00
|
|
|
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58.000000
|
|
|
|
|
15 September 2001 %d %M %Y 00:00:00.000000
|
|
|
|
|
15 SEPTEMB 2001 %d %M %Y 00:00:00.000000
|
|
|
|
|
15 MAY 2001 %d %b %Y 00:00:00.000000
|
|
|
|
|
15th May 2001 %D %b %Y 00:00:00.000000
|
|
|
|
|
Sunday 15 MAY 2001 %W %d %b %Y 00:00:00.000000
|
|
|
|
|
Sund 15 MAY 2001 %W %d %b %Y 00:00:00.000000
|
|
|
|
|
Tuesday 00 2002 %W %U %Y 00:00:00.000000
|
|
|
|
|
Thursday 53 1998 %W %u %Y 00:00:00.000000
|
|
|
|
|
Sunday 01 2001 %W %v %x 00:00:00.000000
|
|
|
|
|
Tuesday 52 2001 %W %V %X 00:00:00.000000
|
|
|
|
|
060 2004 %j %Y 00:00:00.000000
|
|
|
|
|
4 53 1998 %w %u %Y 00:00:00.000000
|
|
|
|
|
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00.000000
|
|
|
|
|
15-01-20 %d-%m-%y 00:00:00.000000
|
|
|
|
|
15-2001-1 %d-%Y-%c 00:00:00.000000
|
2003-11-03 13:01:59 +01:00
|
|
|
|
select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
|
|
|
|
|
date format time2
|
2013-09-12 19:31:14 +02:00
|
|
|
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12.000000
|
|
|
|
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02.000000
|
|
|
|
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02.000000
|
|
|
|
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02.000000
|
|
|
|
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12.000000
|
2004-03-15 15:28:21 +01:00
|
|
|
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
|
|
|
|
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
|
|
|
|
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
|
2013-09-12 19:31:14 +02:00
|
|
|
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12.000000
|
|
|
|
|
10:20:10 %H:%i:%s 10:20:10.000000
|
|
|
|
|
10:20:10 %h:%i:%s.%f 10:20:10.000000
|
|
|
|
|
10:20:10 %T 10:20:10.000000
|
|
|
|
|
10:20:10AM %h:%i:%s%p 10:20:10.000000
|
|
|
|
|
10:20:10AM %r 10:20:10.000000
|
2007-02-08 08:56:18 +01:00
|
|
|
|
10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
|
2013-09-12 19:31:14 +02:00
|
|
|
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58.000000
|
|
|
|
|
15 September 2001 %d %M %Y 00:00:00.000000
|
|
|
|
|
15 SEPTEMB 2001 %d %M %Y 00:00:00.000000
|
|
|
|
|
15 MAY 2001 %d %b %Y 00:00:00.000000
|
|
|
|
|
15th May 2001 %D %b %Y 00:00:00.000000
|
|
|
|
|
Sunday 15 MAY 2001 %W %d %b %Y 00:00:00.000000
|
|
|
|
|
Sund 15 MAY 2001 %W %d %b %Y 00:00:00.000000
|
|
|
|
|
Tuesday 00 2002 %W %U %Y 00:00:00.000000
|
|
|
|
|
Thursday 53 1998 %W %u %Y 00:00:00.000000
|
|
|
|
|
Sunday 01 2001 %W %v %x 00:00:00.000000
|
|
|
|
|
Tuesday 52 2001 %W %V %X 00:00:00.000000
|
|
|
|
|
060 2004 %j %Y 00:00:00.000000
|
|
|
|
|
4 53 1998 %w %u %Y 00:00:00.000000
|
|
|
|
|
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00.000000
|
|
|
|
|
15-01-20 %d-%m-%y 00:00:00.000000
|
|
|
|
|
15-2001-1 %d-%Y-%c 00:00:00.000000
|
2004-12-22 16:58:25 +01:00
|
|
|
|
select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'));
|
|
|
|
|
concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'))
|
|
|
|
|
2003-01-02 08:11:02.123456
|
2003-11-03 13:01:59 +01:00
|
|
|
|
truncate table t1;
|
|
|
|
|
insert into t1 values
|
|
|
|
|
('2003-01-02 10:11:12 PM', '%Y-%m-%d %H:%i:%S %p'),
|
|
|
|
|
('2003-01-02 10:11:12.123456', '%Y-%m-%d %h:%i:%S %p'),
|
|
|
|
|
('2003-01-02 10:11:12AM', '%Y-%m-%d %h:%i:%S.%f %p'),
|
|
|
|
|
('2003-01-02 10:11:12AN', '%Y-%m-%d %h:%i:%S%p'),
|
|
|
|
|
('2003-01-02 10:11:12 PM', '%y-%m-%d %H:%i:%S %p'),
|
|
|
|
|
('10:20:10AM', '%H:%i:%s%p'),
|
|
|
|
|
('15 Septembei 2001', '%d %M %Y'),
|
|
|
|
|
('15 Ju 2001', '%d %M %Y'),
|
|
|
|
|
('Sund 15 MA', '%W %d %b %Y'),
|
|
|
|
|
('Thursdai 12 1998', '%W %u %Y'),
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
('Sunday 01 2001', '%W %v %X'),
|
|
|
|
|
('Tuesday 52 2001', '%W %V %x'),
|
|
|
|
|
('Tuesday 52 2001', '%W %V %Y'),
|
|
|
|
|
('Tuesday 52 2001', '%W %u %x'),
|
|
|
|
|
('7 53 1998', '%w %u %Y'),
|
|
|
|
|
(NULL, get_format(DATE,'USA'));
|
2003-11-03 13:01:59 +01:00
|
|
|
|
select date,format,str_to_date(date, format) as str_to_date from t1;
|
|
|
|
|
date format str_to_date
|
|
|
|
|
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
|
|
|
|
|
2003-01-02 10:11:12.123456 %Y-%m-%d %h:%i:%S %p NULL
|
|
|
|
|
2003-01-02 10:11:12AM %Y-%m-%d %h:%i:%S.%f %p NULL
|
|
|
|
|
2003-01-02 10:11:12AN %Y-%m-%d %h:%i:%S%p NULL
|
|
|
|
|
2003-01-02 10:11:12 PM %y-%m-%d %H:%i:%S %p NULL
|
|
|
|
|
10:20:10AM %H:%i:%s%p NULL
|
|
|
|
|
15 Septembei 2001 %d %M %Y NULL
|
|
|
|
|
15 Ju 2001 %d %M %Y NULL
|
|
|
|
|
Sund 15 MA %W %d %b %Y NULL
|
|
|
|
|
Thursdai 12 1998 %W %u %Y NULL
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
Sunday 01 2001 %W %v %X NULL
|
|
|
|
|
Tuesday 52 2001 %W %V %x NULL
|
|
|
|
|
Tuesday 52 2001 %W %V %Y NULL
|
|
|
|
|
Tuesday 52 2001 %W %u %x NULL
|
|
|
|
|
7 53 1998 %w %u %Y NULL
|
2003-11-03 13:01:59 +01:00
|
|
|
|
NULL %m.%d.%Y NULL
|
2005-03-30 15:00:31 +02:00
|
|
|
|
Warnings:
|
2009-09-10 11:18:29 +02:00
|
|
|
|
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
|
2003-11-03 13:01:59 +01:00
|
|
|
|
select date,format,concat(str_to_date(date, format),'') as con from t1;
|
|
|
|
|
date format con
|
|
|
|
|
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
|
|
|
|
|
2003-01-02 10:11:12.123456 %Y-%m-%d %h:%i:%S %p NULL
|
|
|
|
|
2003-01-02 10:11:12AM %Y-%m-%d %h:%i:%S.%f %p NULL
|
|
|
|
|
2003-01-02 10:11:12AN %Y-%m-%d %h:%i:%S%p NULL
|
|
|
|
|
2003-01-02 10:11:12 PM %y-%m-%d %H:%i:%S %p NULL
|
|
|
|
|
10:20:10AM %H:%i:%s%p NULL
|
|
|
|
|
15 Septembei 2001 %d %M %Y NULL
|
|
|
|
|
15 Ju 2001 %d %M %Y NULL
|
|
|
|
|
Sund 15 MA %W %d %b %Y NULL
|
|
|
|
|
Thursdai 12 1998 %W %u %Y NULL
|
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.
mysql-test/r/date_formats.result:
Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also
some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
function. Also simplified a bit calculation of dates from week number.
2004-08-06 08:01:29 +02:00
|
|
|
|
Sunday 01 2001 %W %v %X NULL
|
|
|
|
|
Tuesday 52 2001 %W %V %x NULL
|
|
|
|
|
Tuesday 52 2001 %W %V %Y NULL
|
|
|
|
|
Tuesday 52 2001 %W %u %x NULL
|
|
|
|
|
7 53 1998 %w %u %Y NULL
|
2003-11-03 13:01:59 +01:00
|
|
|
|
NULL %m.%d.%Y NULL
|
2005-03-30 15:00:31 +02:00
|
|
|
|
Warnings:
|
2009-09-10 11:18:29 +02:00
|
|
|
|
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
|
|
|
|
Warning 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
|
2003-11-03 13:01:59 +01:00
|
|
|
|
truncate table t1;
|
|
|
|
|
insert into t1 values
|
|
|
|
|
('10:20:10AM', '%h:%i:%s'),
|
|
|
|
|
('2003-01-02 10:11:12', '%Y-%m-%d %h:%i:%S'),
|
|
|
|
|
('03-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p');
|
|
|
|
|
select date,format,str_to_date(date, format) as str_to_date from t1;
|
|
|
|
|
date format str_to_date
|
|
|
|
|
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
|
|
|
|
|
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
|
2007-03-23 21:08:31 +01:00
|
|
|
|
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
2004-03-15 15:28:21 +01:00
|
|
|
|
Warnings:
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
|
Warning 1292 Truncated incorrect datetime value: '10:20:10AM'
|
2003-11-03 13:01:59 +01:00
|
|
|
|
select date,format,concat(str_to_date(date, format),'') as con from t1;
|
|
|
|
|
date format con
|
|
|
|
|
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
|
|
|
|
|
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
|
2007-03-23 21:08:31 +01:00
|
|
|
|
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
2004-03-15 15:28:21 +01:00
|
|
|
|
Warnings:
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
|
Warning 1292 Truncated incorrect datetime value: '10:20:10AM'
|
2003-11-03 13:01:59 +01:00
|
|
|
|
drop table t1;
|
2003-10-20 10:24:18 +02:00
|
|
|
|
select get_format(DATE, 'USA') as a;
|
|
|
|
|
a
|
|
|
|
|
%m.%d.%Y
|
|
|
|
|
select get_format(TIME, 'internal') as a;
|
|
|
|
|
a
|
|
|
|
|
%H%i%s
|
|
|
|
|
select get_format(DATETIME, 'eur') as a;
|
|
|
|
|
a
|
2003-11-03 13:01:59 +01:00
|
|
|
|
%Y-%m-%d %H.%i.%s
|
2004-08-11 10:27:19 +02:00
|
|
|
|
select get_format(TIMESTAMP, 'eur') as a;
|
|
|
|
|
a
|
|
|
|
|
%Y-%m-%d %H.%i.%s
|
2003-11-03 13:01:59 +01:00
|
|
|
|
select get_format(DATE, 'TEST') as a;
|
|
|
|
|
a
|
|
|
|
|
NULL
|
|
|
|
|
select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
|
|
|
|
|
str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'))
|
|
|
|
|
NULL
|
2005-03-30 15:00:31 +02:00
|
|
|
|
Warnings:
|
2009-09-10 11:18:29 +02:00
|
|
|
|
Warning 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_date
|
2003-10-30 11:57:26 +01:00
|
|
|
|
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
|
2006-07-28 19:27:01 +02:00
|
|
|
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
|
|
|
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
2003-10-30 11:57:26 +01:00
|
|
|
|
Warnings:
|
2008-02-12 20:09:16 +01:00
|
|
|
|
Note 1003 select makedate(1997,1) AS `makedate(1997,1)`,addtime('31.12.97 11.59.59.999999 PM','1 1.1.1.000002') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime('31.12.97 11.59.59.999999 PM','1 1.1.1.000002') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff('01.01.97 11:59:59.000001 PM','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('15-01-2001 12:59:59','%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('1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
|
2003-11-26 17:06:24 +01:00
|
|
|
|
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;
|
|
|
|
|
date_format(d,"%d")
|
|
|
|
|
14
|
|
|
|
|
14
|
|
|
|
|
drop table t1;
|
2004-03-15 15:28:21 +01:00
|
|
|
|
select str_to_date("2003-....01ABCD-02 10:11:12.0012", "%Y-%.%m%@-%d %H:%i:%S.%f") as a;
|
|
|
|
|
a
|
|
|
|
|
2003-01-02 10:11:12.001200
|
|
|
|
|
create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
|
|
|
|
|
str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
|
|
|
|
|
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
|
|
|
|
|
str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
|
|
|
|
|
describe t1;
|
|
|
|
|
Field Type Null Key Default Extra
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
|
f1 datetime(6) YES NULL
|
|
|
|
|
f2 time(6) YES NULL
|
2004-03-15 15:28:21 +01:00
|
|
|
|
f3 date YES NULL
|
|
|
|
|
f4 date YES NULL
|
|
|
|
|
f5 time YES NULL
|
|
|
|
|
select * from t1;
|
|
|
|
|
f1 f2 f3 f4 f5
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
|
2003-01-02 10:11:12.001200 10:11:12.001200 2003-01-02 0000-00-02 58:00:00
|
2004-03-15 15:28:21 +01:00
|
|
|
|
drop table t1;
|
|
|
|
|
create table t1 select "02 10" as a, "%d %H" as b;
|
|
|
|
|
select str_to_date(a,b) from t1;
|
|
|
|
|
str_to_date(a,b)
|
|
|
|
|
0000-00-02 10:00:00
|
|
|
|
|
create table t2 select str_to_date(a,b) from t1;
|
|
|
|
|
describe t2;
|
|
|
|
|
Field Type Null Key Default Extra
|
2011-03-08 19:41:58 +01:00
|
|
|
|
str_to_date(a,b) datetime(6) YES NULL
|
2004-03-15 15:28:21 +01:00
|
|
|
|
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
|
|
|
|
|
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
|
|
|
|
|
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
|
|
|
|
|
str_to_date("02 10:11:12", "%d %H:%i:%S.%f") as f4,
|
|
|
|
|
str_to_date("02 10:11:12", "%d %H:%i:%S") as f5,
|
|
|
|
|
str_to_date("02 10", "%d %f") as f6;
|
|
|
|
|
f1 f2 f3 f4 f5 f6
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
|
2003-01-02 10:11:12.001200 2003-01-02 10:11:12 2003-01-02 58:11:12.000000 58:11:12 48:00:00.100000
|
2004-03-15 15:28:21 +01:00
|
|
|
|
Warnings:
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
|
Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012'
|
2004-03-15 15:28:21 +01:00
|
|
|
|
drop table t1, t2;
|
|
|
|
|
select str_to_date("2003-01-02 10:11:12.0012ABCD", "%Y-%m-%d %H:%i:%S.%f") as f1,
|
|
|
|
|
addtime("-01:01:01.01 GGG", "-23:59:59.1") as f2,
|
|
|
|
|
microsecond("1997-12-31 23:59:59.01XXXX") as f3;
|
|
|
|
|
f1 f2 f3
|
|
|
|
|
2003-01-02 10:11:12.001200 -25:01:00.110000 10000
|
|
|
|
|
Warnings:
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
|
Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012ABCD'
|
|
|
|
|
Warning 1292 Truncated incorrect time value: '-01:01:01.01 GGG'
|
|
|
|
|
Warning 1292 Truncated incorrect time value: '1997-12-31 23:59:59.01XXXX'
|
2004-03-15 15:28:21 +01:00
|
|
|
|
select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
|
|
|
|
|
str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
|
|
|
|
|
f1 f2
|
|
|
|
|
2003-04-05 2003-04-05 10:11:12.101010
|
|
|
|
|
Warnings:
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
|
Warning 1292 Truncated incorrect date value: '2003-04-05 g'
|
|
|
|
|
Warning 1292 Truncated incorrect datetime value: '2003-04-05 10:11:12.101010234567'
|
2006-07-04 14:40:40 +02:00
|
|
|
|
set names latin1;
|
|
|
|
|
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
|
|
|
|
date_format('2004-01-01','%W (%a), %e %M (%b) %Y')
|
|
|
|
|
Thursday (Thu), 1 January (Jan) 2004
|
|
|
|
|
set lc_time_names=ru_RU;
|
|
|
|
|
set names koi8r;
|
|
|
|
|
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
|
|
|
|
date_format('2004-01-01','%W (%a), %e %M (%b) %Y')
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD>), 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD>) 2004
|
|
|
|
|
set lc_time_names=de_DE;
|
|
|
|
|
set names latin1;
|
|
|
|
|
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
|
|
|
|
date_format('2004-01-01','%W (%a), %e %M (%b) %Y')
|
|
|
|
|
Donnerstag (Do), 1 Januar (Jan) 2004
|
|
|
|
|
set names latin1;
|
|
|
|
|
set lc_time_names=en_US;
|
2005-10-25 18:37:26 +02:00
|
|
|
|
create table t1 (f1 datetime);
|
|
|
|
|
insert into t1 (f1) values ("2005-01-01");
|
|
|
|
|
insert into t1 (f1) values ("2005-02-01");
|
|
|
|
|
select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M");
|
|
|
|
|
d1 d2
|
|
|
|
|
02 February
|
|
|
|
|
01 January
|
|
|
|
|
drop table t1;
|
2006-01-13 14:42:46 +01:00
|
|
|
|
select str_to_date( 1, NULL );
|
|
|
|
|
str_to_date( 1, NULL )
|
|
|
|
|
NULL
|
|
|
|
|
select str_to_date( NULL, 1 );
|
|
|
|
|
str_to_date( NULL, 1 )
|
|
|
|
|
NULL
|
2006-01-16 15:46:37 +01:00
|
|
|
|
select str_to_date( 1, IF(1=1,NULL,NULL) );
|
|
|
|
|
str_to_date( 1, IF(1=1,NULL,NULL) )
|
|
|
|
|
NULL
|
2006-05-04 18:31:10 +02:00
|
|
|
|
SELECT TIME_FORMAT("24:00:00", '%r');
|
|
|
|
|
TIME_FORMAT("24:00:00", '%r')
|
|
|
|
|
12:00:00 AM
|
|
|
|
|
SELECT TIME_FORMAT("00:00:00", '%r');
|
|
|
|
|
TIME_FORMAT("00:00:00", '%r')
|
|
|
|
|
12:00:00 AM
|
|
|
|
|
SELECT TIME_FORMAT("12:00:00", '%r');
|
|
|
|
|
TIME_FORMAT("12:00:00", '%r')
|
|
|
|
|
12:00:00 PM
|
|
|
|
|
SELECT TIME_FORMAT("15:00:00", '%r');
|
|
|
|
|
TIME_FORMAT("15:00:00", '%r')
|
|
|
|
|
03:00:00 PM
|
|
|
|
|
SELECT TIME_FORMAT("01:00:00", '%r');
|
|
|
|
|
TIME_FORMAT("01:00:00", '%r')
|
|
|
|
|
01:00:00 AM
|
|
|
|
|
SELECT TIME_FORMAT("25:00:00", '%r');
|
|
|
|
|
TIME_FORMAT("25:00:00", '%r')
|
|
|
|
|
01:00:00 AM
|
2006-05-04 19:19:37 +02:00
|
|
|
|
SELECT TIME_FORMAT("00:00:00", '%l %p');
|
|
|
|
|
TIME_FORMAT("00:00:00", '%l %p')
|
|
|
|
|
12 AM
|
|
|
|
|
SELECT TIME_FORMAT("01:00:00", '%l %p');
|
|
|
|
|
TIME_FORMAT("01:00:00", '%l %p')
|
|
|
|
|
1 AM
|
|
|
|
|
SELECT TIME_FORMAT("12:00:00", '%l %p');
|
|
|
|
|
TIME_FORMAT("12:00:00", '%l %p')
|
|
|
|
|
12 PM
|
|
|
|
|
SELECT TIME_FORMAT("23:00:00", '%l %p');
|
|
|
|
|
TIME_FORMAT("23:00:00", '%l %p')
|
|
|
|
|
11 PM
|
|
|
|
|
SELECT TIME_FORMAT("24:00:00", '%l %p');
|
|
|
|
|
TIME_FORMAT("24:00:00", '%l %p')
|
|
|
|
|
12 AM
|
|
|
|
|
SELECT TIME_FORMAT("25:00:00", '%l %p');
|
|
|
|
|
TIME_FORMAT("25:00:00", '%l %p')
|
|
|
|
|
1 AM
|
2006-07-11 19:06:29 +02:00
|
|
|
|
SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
|
|
|
|
|
DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896)
|
2013-07-03 09:46:20 +02:00
|
|
|
|
NULL
|
2006-07-11 19:06:29 +02:00
|
|
|
|
Warnings:
|
2006-07-29 04:39:34 +02:00
|
|
|
|
Warning 1292 Incorrect datetime value: '%Y-%m-%d %H:%i:%s'
|
2006-10-05 12:29:00 +02:00
|
|
|
|
select str_to_date('04 /30/2004', '%m /%d/%Y');
|
|
|
|
|
str_to_date('04 /30/2004', '%m /%d/%Y')
|
|
|
|
|
2004-04-30
|
|
|
|
|
select str_to_date('04/30 /2004', '%m /%d /%Y');
|
|
|
|
|
str_to_date('04/30 /2004', '%m /%d /%Y')
|
|
|
|
|
2004-04-30
|
|
|
|
|
select str_to_date('04/30/2004 ', '%m/%d/%Y ');
|
|
|
|
|
str_to_date('04/30/2004 ', '%m/%d/%Y ')
|
|
|
|
|
2004-04-30
|
2006-07-11 19:06:29 +02:00
|
|
|
|
"End of 4.1 tests"
|
2009-01-08 10:25:31 +01:00
|
|
|
|
SELECT DATE_FORMAT("0000-01-01",'%W %d %M %Y') as valid_date;
|
|
|
|
|
valid_date
|
|
|
|
|
Sunday 01 January 0000
|
|
|
|
|
SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date;
|
|
|
|
|
valid_date
|
|
|
|
|
Tuesday 28 February 0000
|
|
|
|
|
SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date;
|
|
|
|
|
valid_date
|
|
|
|
|
Thursday 01 January 2009
|
|
|
|
|
"End of 5.0 tests"
|
2010-11-12 11:12:15 +01:00
|
|
|
|
#
|
|
|
|
|
# Start of 5.1 tests
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr'
|
|
|
|
|
#
|
|
|
|
|
SET NAMES utf8;
|
|
|
|
|
SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535)));
|
|
|
|
|
LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535)))
|
|
|
|
|
%
|
|
|
|
|
SET NAMES latin1;
|
|
|
|
|
#
|
|
|
|
|
# End of 5.1 tests
|
|
|
|
|
#
|