Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.1.67, 5.2.14, 5.3.12, 5.5(EOL), 10.0(EOL), 10.1(EOL)
Description
This script:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci);
|
INSERT INTO t1 VALUES (' 1'),('`1');
|
SELECT * FROM t1 WHERE a IN (1,2,3);
|
returns one row:
+------+
|
| a |
|
+------+
|
| 1 |
|
+------+
|
Now if I make the condition even stroger:
SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
|
It erroneously returns two rows:
+------+
|
| a |
|
+------+
|
| 1 |
|
| `1 |
|
+------+
|
It should return one row.
The problem happens in equal fields propagation in this code:
if (!item || !has_compatible_context(item))
|
item= this;
|
Item_func_in does not set cmp_type of args[0], so has_compatible_context() passes and the field gets erroneously replaced to the string constant which makes Item_func_in::val_int() always evaluate to TRUE.
Attachments
Issue Links
- blocks
-
MDEV-8728 Fix a number of problems in equal field and equal expression propagation
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Affects Version/s | 5.3.12 [ 12000 ] | |
Affects Version/s | 5.2.14 [ 12101 ] | |
Affects Version/s | 5.1.67 [ 12100 ] | |
Affects Version/s | 10.1 [ 16100 ] | |
Affects Version/s | 10.0 [ 16000 ] | |
Affects Version/s | 5.5 [ 15800 ] | |
Labels | upstream |
Fix Version/s | 10.0 [ 16000 ] | |
Fix Version/s | 5.5 [ 15800 ] |
Fix Version/s | 10.1.7 [ 19604 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Labels | upstream | propagation upstream |
Workflow | MariaDB v3 [ 71231 ] | MariaDB v4 [ 149524 ] |