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
aa1002a3
Commit
aa1002a3
authored
Sep 02, 2015
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-8723 Wrong result for SELECT..WHERE COLLATION(a)='binary' AND a='a'
parent
68810129
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
13 deletions
+79
-13
mysql-test/r/ctype_binary.result
mysql-test/r/ctype_binary.result
+38
-0
mysql-test/t/ctype_binary.test
mysql-test/t/ctype_binary.test
+15
-0
sql/item_func.h
sql/item_func.h
+3
-0
sql/item_strfunc.h
sql/item_strfunc.h
+23
-13
No files found.
mysql-test/r/ctype_binary.result
View file @
aa1002a3
...
...
@@ -3101,5 +3101,43 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a ')
DROP TABLE t1;
#
# MDEV-8723 Wrong result for SELECT..WHERE COLLATION(a)='binary' AND a='a'
#
CREATE TABLE t1 (a VARBINARY(10));
INSERT INTO t1 VALUES ('a'),('A');
SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a';
a
a
SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a';
a
a
SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a';
a
a
SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a';
a
a
EXPLAIN EXTENDED SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
EXPLAIN EXTENDED SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
EXPLAIN EXTENDED SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
EXPLAIN EXTENDED SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (weight_string(`test`.`t1`.`a`) = 'a'))
DROP TABLE t1;
#
# End of 10.1 tests
#
mysql-test/t/ctype_binary.test
View file @
aa1002a3
...
...
@@ -56,6 +56,21 @@ SELECT * FROM t1 WHERE a='a ' AND LENGTH(a)=2;
EXPLAIN
EXTENDED
SELECT
*
FROM
t1
WHERE
a
=
'a '
AND
LENGTH
(
a
)
=
2
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-8723 Wrong result for SELECT..WHERE COLLATION(a)='binary' AND a='a'
--
echo
#
CREATE
TABLE
t1
(
a
VARBINARY
(
10
));
INSERT
INTO
t1
VALUES
(
'a'
),(
'A'
);
SELECT
*
FROM
t1
WHERE
COLLATION
(
a
)
=
'binary'
AND
a
=
'a'
;
SELECT
*
FROM
t1
WHERE
CHARSET
(
a
)
=
'binary'
AND
a
=
'a'
;
SELECT
*
FROM
t1
WHERE
COERCIBILITY
(
a
)
=
2
AND
a
=
'a'
;
SELECT
*
FROM
t1
WHERE
WEIGHT_STRING
(
a
)
=
'a'
AND
a
=
'a'
;
EXPLAIN
EXTENDED
SELECT
*
FROM
t1
WHERE
COLLATION
(
a
)
=
'binary'
AND
a
=
'a'
;
EXPLAIN
EXTENDED
SELECT
*
FROM
t1
WHERE
CHARSET
(
a
)
=
'binary'
AND
a
=
'a'
;
EXPLAIN
EXTENDED
SELECT
*
FROM
t1
WHERE
COERCIBILITY
(
a
)
=
2
AND
a
=
'a'
;
EXPLAIN
EXTENDED
SELECT
*
FROM
t1
WHERE
WEIGHT_STRING
(
a
)
=
'a'
AND
a
=
'a'
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# End of 10.1 tests
--
echo
#
sql/item_func.h
View file @
aa1002a3
...
...
@@ -1160,6 +1160,9 @@ class Item_func_coercibility :public Item_int_func
const
char
*
func_name
()
const
{
return
"coercibility"
;
}
void
fix_length_and_dec
()
{
max_length
=
10
;
maybe_null
=
0
;
}
table_map
not_null_tables
()
const
{
return
0
;
}
Item
*
propagate_equal_fields
(
THD
*
thd
,
const
Context
&
ctx
,
COND_EQUAL
*
cond
)
{
return
this
;
}
bool
const_item
()
const
{
return
true
;
}
};
class
Item_func_locate
:
public
Item_int_func
...
...
sql/item_strfunc.h
View file @
aa1002a3
...
...
@@ -1049,12 +1049,11 @@ class Item_func_set_collation :public Item_str_func
}
};
class
Item_func_charset
:
public
Item_str_func
class
Item_func_expr_str_metadata
:
public
Item_str_func
{
public:
Item_func_charset
(
THD
*
thd
,
Item
*
a
)
:
Item_str_func
(
thd
,
a
)
{}
String
*
val_str
(
String
*
);
const
char
*
func_name
()
const
{
return
"charset"
;
}
Item_func_expr_str_metadata
(
THD
*
thd
,
Item
*
a
)
:
Item_str_func
(
thd
,
a
)
{
}
void
fix_length_and_dec
()
{
collation
.
set
(
system_charset_info
);
...
...
@@ -1062,23 +1061,32 @@ class Item_func_charset :public Item_str_func
maybe_null
=
0
;
};
table_map
not_null_tables
()
const
{
return
0
;
}
Item
*
propagate_equal_fields
(
THD
*
thd
,
const
Context
&
ctx
,
COND_EQUAL
*
cond
)
{
return
this
;
}
bool
const_item
()
const
{
return
true
;
}
};
class
Item_func_collation
:
public
Item_str_func
class
Item_func_charset
:
public
Item_func_expr_str_metadata
{
public:
Item_func_collation
(
THD
*
thd
,
Item
*
a
)
:
Item_str_func
(
thd
,
a
)
{}
Item_func_charset
(
THD
*
thd
,
Item
*
a
)
:
Item_func_expr_str_metadata
(
thd
,
a
)
{
}
String
*
val_str
(
String
*
);
const
char
*
func_name
()
const
{
return
"charset"
;
}
};
class
Item_func_collation
:
public
Item_func_expr_str_metadata
{
public:
Item_func_collation
(
THD
*
thd
,
Item
*
a
)
:
Item_func_expr_str_metadata
(
thd
,
a
)
{}
String
*
val_str
(
String
*
);
const
char
*
func_name
()
const
{
return
"collation"
;
}
void
fix_length_and_dec
()
{
collation
.
set
(
system_charset_info
);
max_length
=
64
*
collation
.
collation
->
mbmaxlen
;
// should be enough
maybe_null
=
0
;
};
table_map
not_null_tables
()
const
{
return
0
;
}
};
class
Item_func_weight_string
:
public
Item_str_func
{
String
tmp_value
;
...
...
@@ -1106,6 +1114,8 @@ class Item_func_weight_string :public Item_str_func
this
->
nweights
==
that
->
nweights
&&
this
->
result_length
==
that
->
result_length
;
}
Item
*
propagate_equal_fields
(
THD
*
thd
,
const
Context
&
ctx
,
COND_EQUAL
*
cond
)
{
return
this
;
}
};
class
Item_func_crc32
:
public
Item_int_func
...
...
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