pingcap / pingcap/tidb

Create table didn't check the foreign key referenced column length

Open
#62,715 9 comments 0 reactions 0 assignees View on GitHub
affects-8.5 sig/sql-infra 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 t1(a varchar(222), index(a));
Query OK, 0 rows affected (0.06 sec)

mysql> create table t2(a varchar(2), index(a), constraint fk foreign key(a) references t1(a) on delete restrict);
Query OK, 0 rows affected (0.06 sec)
```

### 2. What did you expect to see? (Required)
The `varchar` length is not equal, table `t2` should't be created success

### 3. What did you see instead (Required)
Table `t2` can be created success
### 4. What is your TiDB version? (Required)
master

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.