HandlerSocket-Plugin-for-MySQL icon indicating copy to clipboard operation
HandlerSocket-Plugin-for-MySQL copied to clipboard

Strange selection for composed keys

Open tz-lom opened this issue 12 years ago • 2 comments

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?

tz-lom avatar May 19 '13 22:05 tz-lom

If it possible, please answer is it a bug or not. If it is, I will try to fix it.

tz-lom avatar May 26 '13 19:05 tz-lom

it's not a bug!

ahiguti avatar Mar 25 '15 01:03 ahiguti