Please answer these questions before submitting your issue. Thanks!
mysql> create table t (x int primary key);
mysql> select * from t force index(primary);
Empty set (0.00 sec)
It is from Oracle MySQL 5.7.22.
ERROR 1105 (HY000): line 1 column 35 near ")" (total length 36)
tidb-server -V or run select tidb_version(); on TiDB)?tidb_version(): Release Version: v2.1.0-rc.4
Git Commit Hash: 500c9bb865b90a834bcd27b7b075c193556b9f37
Git Branch: release-2.1
UTC Build Time: 2018-10-24 05:28:25
GoVersion: go version go1.11 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
hi, @toshipp
Please try
select * from t force index(`primary`)
It works! Thanks.
BTW, does TiDB require backticks?
Do you think it is a compatibility issue or not?
@toshipp PRIMARY is a reserved keyword in MySQL. See: https://dev.mysql.com/doc/refman/8.0/en/keywords.html
@shenli
Yes, I know that.
However, MySQL accepts PRIMARY without backticks in FORCE INDEX.
I think this MySQL behavior is odd, but our application does not work without code changes.
Is the difference considerable?
To be fixed in https://github.com/pingcap/parser/pull/2
Confirming that this issue has been resolved:
MySQL [test]> create table t (x int primary key);
Query OK, 0 rows affected (0.79 sec)
MySQL [test]> select * from t force index(primary);
Empty set (0.01 sec)
MySQL [test]> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v2.1.0-rc.3-156-g5d60849c1
Git Commit Hash: 5d60849c118c34af4d67a4f4cccf7a0cd86e7917
Git Branch: set-password
UTC Build Time: 2018-11-08 12:40:58
GoVersion: go version go1.11 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
1 row in set (0.00 sec)
I will now close this issue.
Most helpful comment
To be fixed in https://github.com/pingcap/parser/pull/2