Planner: can't create a binding for TTL SQL
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
create binding for ttl query
```
mysql> CREATE GLOBAL BINDING FOR SELECT LOW_PRIORITY SQL_NO_CACHE `id` FROM `test`.`t1` WHERE `created_at` < FROM_UNIXTIME(?) ORDER BY `id` ASC LIMIT ? USING SELECT /*+ RESOURCE_GROUP(rg1) */ LOW_PRIORITY SQL_NO_CACHE `id` FROM `test`.`t1` WHERE `created_at` < FROM_UNIXTIME(?) ORDER BY `id` ASC LIMIT ?;
```
### 2. What did you expect to see? (Required)
create success
### 3. What did you see instead (Required)
```
mysql> CREATE GLOBAL BINDING FOR SELECT LOW_PRIORITY SQL_NO_CACHE `id` FROM `test`.`t1` WHERE `created_at` < FROM_UNIXTIME(?) ORDER BY `id` ASC LIMIT ? USING SELECT /*+ RESOURCE_GROUP(rg1) */ LOW_PRIORITY SQL_NO_CACHE `id` FROM `test`.`t1` WHERE `created_at` < FROM_UNIXTIME(?) ORDER BY `id` ASC LIMIT ?;
ERROR 8066 (HY000): Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc.
```
```
### 4. What is your TiDB version? (Required)
Contributor guide
Research direction
No source file or test is named. Start by reproducing the CREATE GLOBAL BINDING command and trace the planner's binding path for the RESOURCE_GROUP optimizer hint; done means the command succeeds and the regression is covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, mysql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100