`datetime(6)` column cannot have `default (current_date)`.
- 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)
```sql
create table a (a datetime(6) default (current_date));
```
### 2. What did you expect to see? (Required)
Query OK
### 3. What did you see instead (Required)
```
ERROR 1067 (42000): Invalid default value for 'a'
```
### 4. What is your TiDB version? (Required)
Reproduced on all of:
* v9.0.0-beta.2-pre-nightly 78eadf20801cee122e18eb449498b9b790f04e96
* v9.0.0-beta.1 7aff918dcbfa6facf2adef9ade9961c40f217421
* v8.5.3
* v8.1.2
* v7.5.7
* v7.1.6
(v6.5.12 does not support expression as default)
Contributor guide
Research direction
Start by running the reported CREATE TABLE statement against the listed TiDB versions and trace the validation of expression defaults for datetime(6). Identify the relevant default-value handling entry point and add a regression test for current_date; done means the statement returns Query OK without regressing existing invalid-default checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100