Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
964c4f07
Commit
964c4f07
authored
May 10, 2016
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-10052 Illegal mix of collations with DAYNAME(date_field)<>varchar_field
parent
672bbcd7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
4 deletions
+51
-4
mysql-test/r/locale.result
mysql-test/r/locale.result
+28
-0
mysql-test/t/locale.test
mysql-test/t/locale.test
+19
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+2
-4
sql/sql_locale.h
sql/sql_locale.h
+2
-0
No files found.
mysql-test/r/locale.result
View file @
964c4f07
...
...
@@ -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;
mysql-test/t/locale.test
View file @
964c4f07
...
...
@@ -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
;
sql/item_timefunc.cc
View file @
964c4f07
...
...
@@ -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
;
...
...
sql/sql_locale.h
View file @
964c4f07
...
...
@@ -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 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment