Support for default value as column
- 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 TABLE default_from_other_col (
id bigint unsigned NOT NULL AUTO_INCREMENT,
src_col timestamp NULL DEFAULT NULL,
new_col timestamp NULL DEFAULT(src_col),
PRIMARY KEY (id)
)
```
### 2. What did you expect to see? (Required)
```
mysql> CREATE TABLE default_from_other_col (
-> id bigint unsigned NOT NULL AUTO_INCREMENT,
-> src_col timestamp NULL DEFAULT NULL,
-> new_col timestamp NULL DEFAULT(src_col),
-> PRIMARY KEY (id)
-> );
Query OK, 0 rows affected (0.005 sec)
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.32 |
+-----------+
1 row in set (0.001 sec)
```
### 3. What did you see instead (Required)
```
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 4 column 42 near "),
PRIMARY KEY (id)
)"
```
### 4. What is your TiDB version? (Required)
```
mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v9.0.0-beta.1.pre-422-g3ccc5aa001
Edition: Community
Git Commit Hash: 3ccc5aa001ec485b1219ea9df9c7e0b3dde4f995
Git Branch: HEAD
UTC Build Time: 2025-03-14 20:26:34
GoVersion: go1.23.7
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.001 sec)
```
Contributor guide
Assessment
This issue has not been assessed yet.