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
5088cbf4
Commit
5088cbf4
authored
Sep 02, 2015
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-8671 Wrong result for SELECT..WHERE varchar_column=' 1' AND (varchar_column XOR '1')
parent
06714302
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
0 deletions
+44
-0
mysql-test/r/ctype_cp1251.result
mysql-test/r/ctype_cp1251.result
+26
-0
mysql-test/t/ctype_cp1251.test
mysql-test/t/ctype_cp1251.test
+13
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+5
-0
No files found.
mysql-test/r/ctype_cp1251.result
View file @
5088cbf4
...
...
@@ -3363,5 +3363,31 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 1') and (`test`.`t1`.`a` in (1,2,3,'x')))
DROP TABLE t1;
#
# MDEV-8671 Wrong result for SELECT..WHERE varchar_column=' 1' AND (varchar_column XOR '1')
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci);
INSERT INTO t1 VALUES (' 1'),('`1');
SELECT * FROM t1 WHERE a=' 1';
a
1
`1
SELECT * FROM t1 WHERE (a XOR '0');
a
1
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '`1'
SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
a
1
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '`1'
# ' 1' should not be propagated into (a XIR '0')
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
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` = ' 1') and (`test`.`t1`.`a` xor '0'))
DROP TABLE t1;
#
# End of 10.1 tests
#
mysql-test/t/ctype_cp1251.test
View file @
5088cbf4
...
...
@@ -126,6 +126,19 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3,'x') AND a=' 1';
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-8671 Wrong result for SELECT..WHERE varchar_column=' 1' AND (varchar_column XOR '1')
--
echo
#
CREATE
TABLE
t1
(
a
VARCHAR
(
10
)
CHARACTER
SET
cp1251
COLLATE
cp1251_ukrainian_ci
);
INSERT
INTO
t1
VALUES
(
' 1'
),(
'`1'
);
SELECT
*
FROM
t1
WHERE
a
=
' 1'
;
SELECT
*
FROM
t1
WHERE
(
a
XOR
'0'
);
SELECT
*
FROM
t1
WHERE
a
=
' 1'
AND
(
a
XOR
'0'
);
--
echo
# ' 1' should not be propagated into (a XIR '0')
EXPLAIN
EXTENDED
SELECT
*
FROM
t1
WHERE
a
=
' 1'
AND
(
a
XOR
'0'
);
DROP
TABLE
t1
;
--
echo
#
--
echo
# End of 10.1 tests
--
echo
#
sql/item_cmpfunc.h
View file @
5088cbf4
...
...
@@ -442,6 +442,11 @@ public:
Item_args
::
propagate_equal_fields
(
thd
,
ANY_SUBST
,
cond
);
return
this
;
}
void
fix_length_and_dec
()
{
Item_bool_func
::
fix_length_and_dec
();
args
[
0
]
->
cmp_context
=
args
[
1
]
->
cmp_context
=
INT_RESULT
;
}
};
class
Item_func_not
:
public
Item_bool_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