HandlerSocket-Plugin-for-MySQL
HandlerSocket-Plugin-for-MySQL copied to clipboard
Strange selection for composed keys
For examle, lets take simple table
CREATE TABLE `read2` (
`k1` int(11) NOT NULL,
`k2` int(11) NOT NULL,
`v` varchar(40) NOT NULL,
PRIMARY KEY (`k1`,`k2`)
)
SELECT * FROM read2;
+----+----+----+
| k1 | k2 | v |
+----+----+----+
| 1 | 1 | A1 |
| 1 | 2 | A2 |
| 1 | 3 | A3 |
| 2 | 1 | B1 |
| 2 | 2 | B2 |
| 2 | 3 | B3 |
| 3 | 1 | C1 |
| 3 | 2 | C2 |
| 3 | 3 | C3 |
+----+----+----+
now, do some selection with comparasions k1>2 k2>1
P 1 HSPHP_test read2 PRIMARY v
0 1
1 > 2 2 1 10
0 1 B2 B3 C1 C2 C3
Now, I can't understand how comparisons work
- it isn't k1>2 OR k2>1, because A3 is not in list
- it isn't k1>2 AND k2>1, because B2 in list
so, how comparisons for composed keys work, is it bug or feature?
If it possible, please answer is it a bug or not. If it is, I will try to fix it.
it's not a bug!