pingcap / pingcap/tidb

Tables contain zero column ID after `CREATE TABLE LIKE`

Open
#62,639 0 comments 0 reactions 0 assignees View on GitHub
affects-6.5 affects-7.1 affects-7.5 affects-8.1 affects-8.5 affects-9.0 component/ddl severity/moderate type/bug
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)

```
mysql> create table t2 like metrics_schema.up;
Query OK, 0 rows affected (0.05 sec)

mysql> insert into t2 values (NULL, 'aa', 'aa', '11');
Query OK, 1 row affected (0.01 sec)
```

```
curl http://127.0.0.1:10080/schema/test/t2
{
"id": 135,
"name": {
"O": "t2",
"L": "t2"
},
"charset": "utf8mb4",
"collate": "utf8mb4_bin",
"cols": [
{
"id": 0,
"name": {
"O": "time",
"L": "time"
},
"offset": 0,
"origin_default": null,
...
```

### 2. What did you expect to see? (Required)

```
mysql> select * from t2;
+------+----------+------+-------+
| time | instance | job | value |
+------+----------+------+-------+
| NULL | aa | aa | 11 |
+------+----------+------+-------+
1 row in set (0.00 sec)
```

### 3. What did you see instead (Required)

```
mysql> table t2;
+------+----------+------+-------+
| time | instance | job | value |
+------+----------+------+-------+
| NULL | NULL | NULL | NULL |
+------+----------+------+-------+
1 row in set (0.00 sec)
```

### 4. What is your TiDB version? (Required)

master (7237eb9cbb)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.