mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix Bug #35261: date_format test fails if new variables LIKE '%e_format' are added
Use SELECT FROM INFORMATION_SCHEMA instead of SHOW VARIABLES LIKE to restrict values correctly.
This commit is contained in:
@ -1,14 +1,20 @@
|
|||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
SHOW GLOBAL VARIABLES LIKE "%e_format";
|
SELECT variable_name, variable_value
|
||||||
Variable_name Value
|
FROM information_schema.global_variables
|
||||||
date_format %d.%m.%Y
|
WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
|
||||||
datetime_format %Y-%m-%d %H:%i:%s
|
ORDER BY variable_name;
|
||||||
time_format %H.%i.%s
|
variable_name variable_value
|
||||||
SHOW SESSION VARIABLES LIKE "%e_format";
|
DATETIME_FORMAT %Y-%m-%d %H:%i:%s
|
||||||
Variable_name Value
|
DATE_FORMAT %d.%m.%Y
|
||||||
date_format %d.%m.%Y
|
TIME_FORMAT %H.%i.%s
|
||||||
datetime_format %Y-%m-%d %H:%i:%s
|
SELECT variable_name, variable_value
|
||||||
time_format %H.%i.%s
|
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
|
||||||
SET time_format='%H%i%s';
|
SET time_format='%H%i%s';
|
||||||
SET time_format='%H:%i:%s.%f';
|
SET time_format='%H:%i:%s.%f';
|
||||||
SET time_format='%h-%i-%s.%f%p';
|
SET time_format='%h-%i-%s.%f%p';
|
||||||
@ -26,11 +32,14 @@ set datetime_format= '%H:%i:%s %Y-%m-%d';
|
|||||||
set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
|
set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
|
||||||
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
|
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
|
||||||
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
|
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
|
||||||
SHOW SESSION VARIABLES LIKE "%e_format";
|
SELECT variable_name, variable_value
|
||||||
Variable_name Value
|
FROM information_schema.session_variables
|
||||||
date_format %m-%d-%Y
|
WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
|
||||||
datetime_format %h:%i:%s.%f %p %Y-%m-%d
|
ORDER BY variable_name;
|
||||||
time_format %h:%i:%s%p
|
variable_name variable_value
|
||||||
|
DATETIME_FORMAT %h:%i:%s.%f %p %Y-%m-%d
|
||||||
|
DATE_FORMAT %m-%d-%Y
|
||||||
|
TIME_FORMAT %h:%i:%s%p
|
||||||
SET time_format='%h:%i:%s';
|
SET time_format='%h:%i:%s';
|
||||||
ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s'
|
ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s'
|
||||||
SET time_format='%H %i:%s';
|
SET time_format='%H %i:%s';
|
||||||
|
@ -6,10 +6,15 @@
|
|||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
--replace_result ROW <format> STATEMENT <format> MIXED <format>
|
SELECT variable_name, variable_value
|
||||||
SHOW GLOBAL VARIABLES LIKE "%e_format";
|
FROM information_schema.global_variables
|
||||||
--replace_result ROW <format> STATEMENT <format> MIXED <format>
|
WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
|
||||||
SHOW SESSION VARIABLES LIKE "%e_format";
|
ORDER BY variable_name;
|
||||||
|
|
||||||
|
SELECT variable_name, variable_value
|
||||||
|
FROM information_schema.session_variables
|
||||||
|
WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
|
||||||
|
ORDER BY variable_name;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test setting a lot of different formats to see which formats are accepted and
|
# Test setting a lot of different formats to see which formats are accepted and
|
||||||
@ -36,8 +41,10 @@ set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
|
|||||||
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
|
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
|
||||||
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
|
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
|
||||||
|
|
||||||
--replace_result ROW <format> STATEMENT <format> MIXED <format>
|
SELECT variable_name, variable_value
|
||||||
SHOW SESSION VARIABLES LIKE "%e_format";
|
FROM information_schema.session_variables
|
||||||
|
WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
|
||||||
|
ORDER BY variable_name;
|
||||||
|
|
||||||
--error 1231
|
--error 1231
|
||||||
SET time_format='%h:%i:%s';
|
SET time_format='%h:%i:%s';
|
||||||
@ -121,7 +128,7 @@ SET datetime_format=default;
|
|||||||
# Test of str_to_date
|
# Test of str_to_date
|
||||||
#
|
#
|
||||||
|
|
||||||
# PS doesn't support fraction of a seconds
|
# PS doesn't support fractions of a second
|
||||||
--disable_ps_protocol
|
--disable_ps_protocol
|
||||||
select str_to_date(concat('15-01-2001',' 2:59:58.999'),
|
select str_to_date(concat('15-01-2001',' 2:59:58.999'),
|
||||||
concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
|
concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
|
||||||
|
Reference in New Issue
Block a user