@@ -1419,3 +1419,193 @@ Note 1105 Cannot use key parts with `test`.`t1`.`indexed_col` in the rewritten c
1419
1419
DROP TABLE t2;
1420
1420
DROP TABLE t1;
1421
1421
SET note_verbosity=DEFAULT;
1422
+ #
1423
+ # MDEV-36235 Incorrect result for BETWEEN over unique blob prefix
1424
+ #
1425
+ CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2))) engine=myisam;
1426
+ INSERT INTO t1 (c1) VALUES (1);
1427
+ SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
1428
+ c1
1429
+ 1
1430
+ Warnings:
1431
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1432
+ DROP TABLE t1;
1433
+ CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2)));
1434
+ INSERT INTO t1 (c1) VALUES (1),(2),(3),(4),(5);
1435
+ SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
1436
+ c1
1437
+ 1
1438
+ 2
1439
+ 3
1440
+ 4
1441
+ 5
1442
+ Warnings:
1443
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1444
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1445
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1446
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1447
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1448
+ SELECT c1 FROM t1 WHERE 3 BETWEEN 10*POW(-1,c1) AND (c1);
1449
+ c1
1450
+ 3
1451
+ 5
1452
+ SELECT c1 FROM t1 WHERE 'a' BETWEEN 10*POW(-1,c1) AND (c1);
1453
+ c1
1454
+ 1
1455
+ 3
1456
+ 5
1457
+ Warnings:
1458
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1459
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1460
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1461
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1462
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1463
+ DROP TABLE t1;
1464
+ CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2))) engine=myisam;
1465
+ INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
1466
+ SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
1467
+ c1
1468
+ 1
1469
+ 2
1470
+ 3
1471
+ 4
1472
+ 5
1473
+ Warnings:
1474
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1475
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1476
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1477
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1478
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1479
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1480
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1481
+ SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
1482
+ c1
1483
+ -2
1484
+ -1
1485
+ Warnings:
1486
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1487
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1488
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1489
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1490
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1491
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1492
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1493
+ DROP TABLE t1;
1494
+ CREATE TABLE t1 (c1 TINYBLOB NOT NULL);
1495
+ INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
1496
+ SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
1497
+ c1
1498
+ 1
1499
+ 2
1500
+ 3
1501
+ 4
1502
+ 5
1503
+ Warnings:
1504
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1505
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1506
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1507
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1508
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1509
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1510
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1511
+ SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
1512
+ c1
1513
+ -2
1514
+ -1
1515
+ Warnings:
1516
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1517
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1518
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1519
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1520
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1521
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1522
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1523
+ DROP TABLE t1;
1524
+ CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2))) engine=innodb;
1525
+ INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
1526
+ SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
1527
+ c1
1528
+ 1
1529
+ 2
1530
+ 3
1531
+ 4
1532
+ 5
1533
+ Warnings:
1534
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1535
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1536
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1537
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1538
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1539
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1540
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1541
+ SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
1542
+ c1
1543
+ -2
1544
+ -1
1545
+ Warnings:
1546
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1547
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1548
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1549
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1550
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1551
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1552
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1553
+ ALTER TABLE t1 engine=myisam;
1554
+ SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
1555
+ c1
1556
+ 1
1557
+ 2
1558
+ 3
1559
+ 4
1560
+ 5
1561
+ Warnings:
1562
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1563
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1564
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1565
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1566
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1567
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1568
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1569
+ SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
1570
+ c1
1571
+ -2
1572
+ -1
1573
+ Warnings:
1574
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1575
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1576
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1577
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1578
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1579
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1580
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1581
+ DROP TABLE t1;
1582
+ CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1)) engine=innodb;
1583
+ INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
1584
+ SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
1585
+ c1
1586
+ 1
1587
+ 2
1588
+ 3
1589
+ 4
1590
+ 5
1591
+ Warnings:
1592
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1593
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1594
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1595
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1596
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1597
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1598
+ Warning 1292 Truncated incorrect DOUBLE value: 'a'
1599
+ SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
1600
+ c1
1601
+ -2
1602
+ -1
1603
+ Warnings:
1604
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1605
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1606
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1607
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1608
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1609
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1610
+ Warning 1292 Truncated incorrect DECIMAL value: '#'
1611
+ DROP TABLE t1;
0 commit comments