dble icon indicating copy to clipboard operation
dble copied to clipboard

Incorrect result on`select syntax` when it contains `use index()` or `use key()`

Open FlyingMao opened this issue 7 years ago • 0 comments

steps:

mysql> CREATE TABLE test_shard(`id` int(10) unsigned NOT NULL,`t_id` int(10) unsigned NOT NULL DEFAULT '0',`name` char(120) NOT NULL DEFAULT '',`pad` int(11) NOT NULL,PRIMARY KEY (`id`),KEY `k_1` (`t_id`));
Query OK, 0 rows affected (0.05 sec)

mysql> insert into test_shard values(1,1,'test中id为1',1),(2,2,'test_2',2),(3,3,'test中id为3',4),(4,4,'$test$4',3),(5,5,'test...5',1),(6,6,'test6',6);
Query OK, 6 rows affected (0.06 sec)

mysql> create index pad_index on test_shard(pad);
Query OK, 0 rows affected (2.31 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> select * from test_shard t use index();
ERROR 1064 (HY000): error RPAREN index

mysql> select * from test_shard a use key();
ERROR 1064 (HY000): error RPAREN key

FlyingMao avatar Jan 04 '18 08:01 FlyingMao