`desc {view_name}` return the primary key flag but doesn't return default value
- 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 (id INT PRIMARY KEY, val INT NULL DEFAULT 2);
CREATE VIEW B AS SELECT id, val FROM A;
```
### 2. What did you expect to see? (Required)
```
mysql> desc B;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(11) | NO | | NULL | |
| val | int(11) | YES | | 2 | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.03 sec)
```
- The default value `2` should be returned
- The primary key flag `PRI` should not be returned (I'm not sure if this is suitable for all views)
### 3. What did you see instead (Required)
```
tidb> desc B;
+-------+---------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+------+---------+-------+
| id | int(11) | NO | PRI | NULL | |
| val | int(11) | YES | | NULL | |
+-------+---------+------+------+---------+-------+
2 rows in set (0.00 sec)
```
### 4. What is your TiDB version? (Required)
```
*************************** 1. row ***************************
tidb_version(): Release Version: v7.0.0
Edition: Community
Git Commit Hash: 7376954cd868dbc44fc3015c9ef89c53749339a7
Git Branch: heads/refs/tags/v7.0.0
UTC Build Time: 2023-03-29 13:22:40
GoVersion: go1.20.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)
```
Contributor guide
Assessment
This issue has not been assessed yet.