mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
MDEV-8671 Wrong result for SELECT..WHERE varchar_column=' 1' AND (varchar_column XOR '1')
This commit is contained in:
@@ -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')))
|
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;
|
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
|
# End of 10.1 tests
|
||||||
#
|
#
|
||||||
|
@@ -126,6 +126,19 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3,'x') AND a=' 1';
|
|||||||
DROP TABLE t1;
|
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 #
|
||||||
--echo # End of 10.1 tests
|
--echo # End of 10.1 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@@ -442,6 +442,11 @@ public:
|
|||||||
Item_args::propagate_equal_fields(thd, ANY_SUBST, cond);
|
Item_args::propagate_equal_fields(thd, ANY_SUBST, cond);
|
||||||
return this;
|
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
|
class Item_func_not :public Item_bool_func
|
||||||
|
Reference in New Issue
Block a user