mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-10052 Illegal mix of collations with DAYNAME(date_field)<>varchar_field
This commit is contained in:
@ -101,3 +101,31 @@ Februar
|
||||
SELECT monthname('2001-03-01');
|
||||
monthname('2001-03-01')
|
||||
März
|
||||
#
|
||||
# MDEV-10052 Illegal mix of collations with DAYNAME(date_field)<>varchar_field
|
||||
#
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE t1 (c VARCHAR(8) CHARACTER SET latin1, d DATE);
|
||||
INSERT INTO t1 VALUES ('test',now());
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'd' at row 1
|
||||
SET lc_time_names=ru_RU;
|
||||
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
|
||||
ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<>'
|
||||
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
|
||||
ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<>'
|
||||
SET lc_time_names=en_US;
|
||||
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
|
||||
c
|
||||
test
|
||||
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
|
||||
c
|
||||
test
|
||||
SET NAMES latin1;
|
||||
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
|
||||
c
|
||||
test
|
||||
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
|
||||
c
|
||||
test
|
||||
DROP TABLE t1;
|
||||
|
@ -63,3 +63,22 @@ 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;
|
||||
|
@ -935,9 +935,8 @@ void Item_func_monthname::fix_length_and_dec()
|
||||
{
|
||||
THD* thd= current_thd;
|
||||
CHARSET_INFO *cs= thd->variables.collation_connection;
|
||||
uint32 repertoire= my_charset_repertoire(cs);
|
||||
locale= thd->variables.lc_time_names;
|
||||
collation.set(cs, DERIVATION_COERCIBLE, repertoire);
|
||||
collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire());
|
||||
decimals=0;
|
||||
max_length= locale->max_month_name_length * collation.collation->mbmaxlen;
|
||||
maybe_null=1;
|
||||
@ -1082,9 +1081,8 @@ void Item_func_dayname::fix_length_and_dec()
|
||||
{
|
||||
THD* thd= current_thd;
|
||||
CHARSET_INFO *cs= thd->variables.collation_connection;
|
||||
uint32 repertoire= my_charset_repertoire(cs);
|
||||
locale= thd->variables.lc_time_names;
|
||||
collation.set(cs, DERIVATION_COERCIBLE, repertoire);
|
||||
collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire());
|
||||
decimals=0;
|
||||
max_length= locale->max_day_name_length * collation.collation->mbmaxlen;
|
||||
maybe_null=1;
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
grouping(grouping_par),
|
||||
errmsgs(errmsgs_par)
|
||||
{}
|
||||
uint repertoire() const
|
||||
{ return is_ascii ? MY_REPERTOIRE_ASCII : MY_REPERTOIRE_EXTENDED; }
|
||||
};
|
||||
/* Exported variables */
|
||||
|
||||
|
Reference in New Issue
Block a user