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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
df144880
Commit
df144880
authored
Jun 10, 2016
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-10181 Illegal mix of collation for a field and an ASCII string as a view field
parent
7adf04e2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
13 deletions
+76
-13
mysql-test/r/ctype_recoding.result
mysql-test/r/ctype_recoding.result
+32
-1
mysql-test/t/ctype_recoding.test
mysql-test/t/ctype_recoding.test
+27
-1
sql/field.cc
sql/field.cc
+1
-0
sql/field.h
sql/field.h
+12
-9
sql/sql_select.cc
sql/sql_select.cc
+4
-2
No files found.
mysql-test/r/ctype_recoding.result
View file @
df144880
...
...
@@ -277,9 +277,40 @@ CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('m'),('n');
CREATE VIEW v1 AS SELECT 'w' ;
SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 );
ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<='
a
m
n
drop view v1;
drop table t1;
SET character_set_connection = default;
SET optimizer_switch= default;
#End of 5.3 tests
#
# Start of 5.5 tests
#
#
# MDEV-10181 Illegal mix of collation for a field and an ASCII string as a view field
#
SET NAMES utf8;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('A'),('a'),('B'),('b');
CREATE VIEW v1 AS SELECT 'a';
SELECT * FROM v1,t1 where t1.a=v1.a;
a a
a A
a a
DROP VIEW v1;
DROP TABLE t1;
SET NAMES utf8;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('a'),('b'),('c');
CREATE VIEW v1 AS SELECT 'a' AS a UNION SELECT 'b';
SELECT * FROM v1,t1 WHERE t1.a=v1.a;
a a
a a
b b
DROP VIEW v1;
DROP TABLE t1;
#
# End of 5.5 tests
#
mysql-test/t/ctype_recoding.test
View file @
df144880
...
...
@@ -220,7 +220,6 @@ SET character_set_connection = utf8;
CREATE
TABLE
t1
(
a
VARCHAR
(
1
)
);
INSERT
INTO
t1
VALUES
(
'm'
),(
'n'
);
CREATE
VIEW
v1
AS
SELECT
'w'
;
--
error
ER_CANT_AGGREGATE_2COLLATIONS
SELECT
*
FROM
t1
WHERE
a
<
ALL
(
SELECT
*
FROM
v1
);
drop
view
v1
;
drop
table
t1
;
...
...
@@ -228,3 +227,30 @@ SET character_set_connection = default;
SET
optimizer_switch
=
default
;
--
echo
#End of 5.3 tests
--
echo
#
--
echo
# Start of 5.5 tests
--
echo
#
--
echo
#
--
echo
# MDEV-10181 Illegal mix of collation for a field and an ASCII string as a view field
--
echo
#
SET
NAMES
utf8
;
CREATE
TABLE
t1
(
a
VARCHAR
(
10
)
CHARACTER
SET
latin1
);
INSERT
INTO
t1
VALUES
(
'A'
),(
'a'
),(
'B'
),(
'b'
);
CREATE
VIEW
v1
AS
SELECT
'a'
;
SELECT
*
FROM
v1
,
t1
where
t1
.
a
=
v1
.
a
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
SET
NAMES
utf8
;
CREATE
TABLE
t1
(
a
VARCHAR
(
10
)
CHARACTER
SET
latin1
);
INSERT
INTO
t1
VALUES
(
'a'
),(
'b'
),(
'c'
);
CREATE
VIEW
v1
AS
SELECT
'a'
AS
a
UNION
SELECT
'b'
;
SELECT
*
FROM
v1
,
t1
WHERE
t1
.
a
=
v1
.
a
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# End of 5.5 tests
--
echo
#
sql/field.cc
View file @
df144880
...
...
@@ -1701,6 +1701,7 @@ Field_str::Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
if
(
charset_arg
->
state
&
MY_CS_BINSORT
)
flags
|=
BINARY_FLAG
;
field_derivation
=
DERIVATION_IMPLICIT
;
field_repertoire
=
my_charset_repertoire
(
charset_arg
);
}
...
...
sql/field.h
View file @
df144880
...
...
@@ -580,11 +580,12 @@ class Field
{
return
binary
()
?
&
my_charset_bin
:
charset
();
}
virtual
CHARSET_INFO
*
sort_charset
(
void
)
const
{
return
charset
();
}
virtual
bool
has_charset
(
void
)
const
{
return
FALSE
;
}
virtual
void
set_charset
(
CHARSET_INFO
*
charset_arg
)
{
}
virtual
enum
Derivation
derivation
(
void
)
const
{
return
DERIVATION_IMPLICIT
;
}
virtual
uint
repertoire
(
void
)
const
{
return
MY_REPERTOIRE_UNICODE30
;
}
virtual
void
set_derivation
(
enum
Derivation
derivation_arg
)
{
}
virtual
void
set_derivation
(
enum
Derivation
derivation_arg
,
uint
repertoire_arg
)
{
}
virtual
int
set_time
()
{
return
1
;
}
void
set_warning
(
MYSQL_ERROR
::
enum_warning_level
,
unsigned
int
code
,
int
cuted_increment
);
...
...
@@ -775,8 +776,10 @@ class Field_num :public Field {
class
Field_str
:
public
Field
{
protected:
// TODO-10.2: Reuse DTCollation instead of these three members
CHARSET_INFO
*
field_charset
;
enum
Derivation
field_derivation
;
uint
field_repertoire
;
public:
Field_str
(
uchar
*
ptr_arg
,
uint32
len_arg
,
uchar
*
null_ptr_arg
,
uchar
null_bit_arg
,
utype
unireg_check_arg
,
...
...
@@ -799,15 +802,15 @@ class Field_str :public Field {
int
store_decimal
(
const
my_decimal
*
);
int
store
(
const
char
*
to
,
uint
length
,
CHARSET_INFO
*
cs
)
=
0
;
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
uint
repertoire
(
void
)
const
{
return
my_charset_repertoire
(
field_charset
);
}
uint
repertoire
(
void
)
const
{
return
field_repertoire
;
}
CHARSET_INFO
*
charset
(
void
)
const
{
return
field_charset
;
}
void
set_charset
(
CHARSET_INFO
*
charset_arg
)
{
field_charset
=
charset_arg
;
}
enum
Derivation
derivation
(
void
)
const
{
return
field_derivation
;
}
virtual
void
set_derivation
(
enum
Derivation
derivation_arg
)
{
field_derivation
=
derivation_arg
;
}
void
set_derivation
(
enum
Derivation
derivation_arg
,
uint
repertoire_arg
)
{
field_derivation
=
derivation_arg
;
field_repertoire
=
repertoire_arg
;
}
bool
binary
()
const
{
return
field_charset
==
&
my_charset_bin
;
}
uint32
max_display_length
()
{
return
field_length
;
}
friend
class
Create_field
;
...
...
sql/sql_select.cc
View file @
df144880
...
...
@@ -14586,7 +14586,8 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
item
->
collation
.
collation
);
else
new_field
=
item
->
make_string_field
(
table
);
new_field
->
set_derivation
(
item
->
collation
.
derivation
);
new_field
->
set_derivation
(
item
->
collation
.
derivation
,
item
->
collation
.
repertoire
);
break
;
case
DECIMAL_RESULT
:
new_field
=
Field_new_decimal
::
create_from_item
(
item
);
...
...
@@ -14825,7 +14826,8 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
modify_item
,
convert_blob_length
);
case
Item
:
:
TYPE_HOLDER
:
result
=
((
Item_type_holder
*
)
item
)
->
make_field_by_type
(
table
);
result
->
set_derivation
(
item
->
collation
.
derivation
);
result
->
set_derivation
(
item
->
collation
.
derivation
,
item
->
collation
.
repertoire
);
return
result
;
default:
// Dosen't have to be stored
return
0
;
...
...
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