mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 09:14:17 +01:00
c054a62816
Kenyan Swahili is enabled for error messages as well as datetime. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
249 lines
6.9 KiB
Text
249 lines
6.9 KiB
Text
--disable_warnings
|
|
DROP TABLE IF EXISTS t1;
|
|
--enable_warnings
|
|
|
|
--echo Start of 5.4 tests
|
|
|
|
--echo #
|
|
--echo # WL#4642 Greek locale for DAYNAME, MONTHNAME, DATE_FORMAT
|
|
--echo #
|
|
|
|
SET NAMES utf8;
|
|
|
|
SET @@lc_time_names=109;
|
|
SELECT @@lc_time_names;
|
|
|
|
CREATE TABLE t1 (a DATE);
|
|
INSERT INTO t1 VALUES
|
|
('2006-01-01'),('2006-01-02'),('2006-01-03'),
|
|
('2006-01-04'),('2006-01-05'),('2006-01-06'),('2006-01-07');
|
|
SELECT a, date_format(a,'%a') as abday, dayname(a) as day FROM t1 ORDER BY a;
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (a DATE);
|
|
INSERT INTO t1 VALUES
|
|
('2006-01-01'),('2006-02-01'),('2006-03-01'),
|
|
('2006-04-01'),('2006-05-01'),('2006-06-01'),
|
|
('2006-07-01'),('2006-08-01'),('2006-09-01'),
|
|
('2006-10-01'),('2006-11-01'),('2006-12-01');
|
|
SELECT a, date_format(a,'%b') as abmon, monthname(a) as mon FROM t1 ORDER BY a;
|
|
|
|
SELECT format(123456.789, 3, 'el_GR');
|
|
DROP TABLE t1;
|
|
|
|
--echo #
|
|
--echo # Bug#46633 Obsolete Serbian locale name
|
|
--echo #
|
|
SET lc_messages=sr_YU;
|
|
SHOW VARIABLES LIKE 'lc_messages';
|
|
SET lc_messages=sr_RS;
|
|
SHOW VARIABLES LIKE 'lc_messages';
|
|
SET lc_time_names=sr_RS;
|
|
SELECT format(123456.789, 3, 'sr_RS');
|
|
|
|
--echo #
|
|
--echo # Bug#43207 wrong LC_TIME names for romanian locale
|
|
--echo #
|
|
SET NAMES utf8;
|
|
SET lc_time_names=ro_RO;
|
|
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
|
|
--echo End of 5.4 tests
|
|
|
|
#
|
|
# MDEV-9928 LC_TIME_NAMES=de_AT; unusual name for february
|
|
#
|
|
SET NAMES utf8;
|
|
SET lc_time_names=de_AT;
|
|
SELECT monthname('2001-01-01');
|
|
SELECT monthname('2001-02-01');
|
|
SELECT monthname('2001-03-01');
|
|
|
|
--echo #
|
|
--echo # MDEV-10052 Illegal mix of collations with DAYNAME(date_field)<>varchar_field
|
|
--echo #
|
|
SET NAMES utf8;
|
|
CREATE TABLE t1 (c VARCHAR(8) CHARACTER SET latin1, d DATE);
|
|
INSERT INTO t1 VALUES ('test',now());
|
|
SET lc_time_names=ru_RU;
|
|
--error ER_CANT_AGGREGATE_2COLLATIONS
|
|
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
|
|
--error ER_CANT_AGGREGATE_2COLLATIONS
|
|
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
|
|
SET lc_time_names=en_US;
|
|
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
|
|
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
|
|
SET NAMES latin1;
|
|
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
|
|
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
|
|
DROP TABLE t1;
|
|
|
|
--echo #
|
|
--echo # Start of 5.6 tests
|
|
--echo #
|
|
|
|
--echo #
|
|
--echo # WL#5303 Romansh locale for DAYNAME, MONTHNAME, DATE_FORMAT
|
|
--echo #
|
|
|
|
SET NAMES utf8;
|
|
SET @old_50915_lc_time_names := @@lc_time_names;
|
|
SET lc_time_names=en_US;
|
|
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-03-01', '%c %b %M');
|
|
SET lc_time_names=rm_CH;
|
|
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-01-01', '%c %b %M');
|
|
SELECT DATE_FORMAT('2001-02-01', '%c %b %M');
|
|
SELECT DATE_FORMAT('2001-03-01', '%c %b %M');
|
|
SELECT DATE_FORMAT('2001-04-01', '%c %b %M');
|
|
SELECT DATE_FORMAT('2001-05-01', '%c %b %M');
|
|
SELECT DATE_FORMAT('2001-06-01', '%c %b %M');
|
|
SELECT DATE_FORMAT('2001-07-01', '%c %b %M');
|
|
SELECT DATE_FORMAT('2001-08-01', '%c %b %M');
|
|
SELECT DATE_FORMAT('2001-09-01', '%c %b %M');
|
|
SELECT DATE_FORMAT('2001-10-01', '%c %b %M');
|
|
SELECT DATE_FORMAT('2001-11-01', '%c %b %M');
|
|
SELECT DATE_FORMAT('2001-12-01', '%c %b %M');
|
|
SET lc_time_names=de_CH;
|
|
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
|
|
SELECT DATE_FORMAT('2001-09-01', '%c %b %M');
|
|
|
|
# Checking AM/PM
|
|
SELECT DATE_FORMAT('2010-03-23 11:00:00','%h %p');
|
|
SELECT DATE_FORMAT('2010-03-23 13:00:00','%h %p');
|
|
|
|
# Checking numeric format
|
|
SELECT format(123456789,2,'rm_CH');
|
|
|
|
# Checking that error messages point to en_US.
|
|
SET lc_messages=rm_CH;
|
|
--error ER_NO_SUCH_TABLE
|
|
SELECT * FROM non_existent;
|
|
|
|
SET lc_time_names=@old_50915_lc_time_names;
|
|
|
|
--echo #
|
|
--echo # End of 10.0 tests
|
|
--echo #
|
|
|
|
--echo #
|
|
--echo # End of 10.1 tests
|
|
--echo #
|
|
|
|
# Item::print
|
|
create view v1 as select
|
|
date_format('2001-10-02', '%c %b %M') as a,
|
|
date_format('2001-10-02', '%c %b %M', 'ru_RU') as a1,
|
|
format(123456789,2) as b,
|
|
format(123456789,2,'rm_CH') as b1;
|
|
select * from v1;
|
|
show create view v1;
|
|
drop view v1;
|
|
|
|
--echo #
|
|
--echo # End of 10.2 tests
|
|
--echo #
|
|
|
|
#
|
|
# MDEV-11553 Can't restore a PERSISTENT column that uses DATE_FORMAT()
|
|
#
|
|
# 3-argument syntax for DATE_FORMAT()
|
|
select date_format('2001-01-01', '%w %a %W', 'ro_RO');
|
|
select date_format('2001-01-03', '%w %a %W', 'ro_RO');
|
|
select date_format('2001-01-05', '%w %a %W', 'ro_RO');
|
|
select date_format('2001-01-07', '%w %a %W', 'ro_RO');
|
|
select date_format('2001-01-01', '%w %a %W', 'de_AT');
|
|
select date_format('2001-02-01', '%w %a %W', 'de_AT');
|
|
select date_format('2001-03-01', '%w %a %W', 'de_AT');
|
|
select date_format('2001-01-01', '%w %a %W', 'en_US');
|
|
select date_format('2001-03-01', '%c %b %M', 'en_US');
|
|
select date_format('2001-01-01', '%w %a %W', 'rm_CH');
|
|
select date_format('2001-01-03', '%w %a %W', 'rm_CH');
|
|
select date_format('2001-01-05', '%w %a %W', 'rm_CH');
|
|
select date_format('2001-01-07', '%w %a %W', 'rm_CH');
|
|
select date_format('2001-02-01', '%c %b %M', 'rm_CH');
|
|
select date_format('2001-04-01', '%c %b %M', 'rm_CH');
|
|
select date_format('2001-06-01', '%c %b %M', 'rm_CH');
|
|
select date_format('2001-08-01', '%c %b %M', 'rm_CH');
|
|
select date_format('2001-10-01', '%c %b %M', 'rm_CH');
|
|
select date_format('2001-12-01', '%c %b %M', 'rm_CH');
|
|
select date_format('2001-01-06', '%w %a %W', 'de_CH');
|
|
select date_format('2001-09-01', '%c %b %M', 'de_CH');
|
|
|
|
--echo #
|
|
--echo # MDEV-30630 locale: Chinese error message for ZH_CN
|
|
--echo #
|
|
|
|
SET lc_messages=ZH_CN;
|
|
--error ER_BAD_FIELD_ERROR
|
|
SELECT x;
|
|
|
|
SET lc_messages=DEFAULT;
|
|
|
|
--echo #
|
|
--echo # End of 10.4 tests
|
|
--echo #
|
|
|
|
|
|
--echo #
|
|
--echo # MDEV-30789 Add Georgian error messages and locale
|
|
--echo #
|
|
|
|
SET lc_messages=ka_GE;
|
|
--error ER_BAD_FIELD_ERROR
|
|
SELECT x;
|
|
|
|
SET lc_messages=DEFAULT;
|
|
|
|
|
|
--echo #
|
|
--echo # Add Swahili error messages and locale
|
|
--echo #
|
|
|
|
SET lc_messages=sw_KE;
|
|
--error ER_BAD_FIELD_ERROR
|
|
SELECT x;
|
|
|
|
SET lc_messages=DEFAULT;
|
|
|
|
|
|
--echo #
|
|
--echo # MDEV-30997 SIGSEGV in __strlen_avx2 | make_date_time | Item_func_date_format::val_str
|
|
--echo #
|
|
|
|
SET lc_messages=en_US;
|
|
SET lc_time_names=111;
|
|
SELECT DATE_FORMAT('1-12-01','%c %b %M');
|
|
CREATE TABLE t1 (i INT);
|
|
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
|
|
SELECT d, DATE_FORMAT(d, '%b') AS MONTH_ABBR, MONTHNAME(d) FROM
|
|
(
|
|
SELECT CAST(CONCAT('2001-', i, '-01') AS DATE) AS d FROM t1
|
|
) d1 ORDER BY d;
|
|
|
|
SELECT d, WEEKDAY(d), DATE_FORMAT(d, '%a') AS DAY_ABBR, DAYNAME(d) FROM
|
|
(
|
|
SELECT CAST(CONCAT('2001-01-', i) AS DATE) AS d FROM t1 WHERE i BETWEEN 1 AND 7
|
|
) d1 ORDER BY d;
|
|
|
|
|
|
DROP TABLE t1;
|
|
SET lc_time_names=DEFAULT;
|
|
SET lc_messages=DEFAULT;
|
|
|
|
|
|
--echo #
|
|
--echo # End of 10.11 tests
|
|
--echo #
|