pingcap / pingcap/tidb

sometimes it will success when adding a column with invalid default value

Open
#47,870 0 comments 0 reactions 0 assignees View on GitHub
affects-7.5 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)

```
set sql_mode='';
create table t1(a int);
alter table t1 add column (b int unsigned default '-1');
```

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

Same with MySQL, an error should be reported:

```
mysql> alter table t1 add column (b int unsigned default '-1');
ERROR 1067 (42000): Invalid default value for 'b'
```

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

Tidb success when adding a column with default value '-1'

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

master, I think it affects all TiDB versions

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.