Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When sql_mode is empty, there is a problem creating default values for columns that are out of bounds #52972

Closed
zimulala opened this issue Apr 29, 2024 · 0 comments · Fixed by #52988

Comments

@zimulala
Copy link
Contributor

zimulala commented Apr 29, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set @@sql_mode='';
drop table if exists t1;
create table t1(b tinyint default '11111111');
alter table t1 add column(c tinyint default '11111111');

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

MySQL 5.7.44 and MySQL 8.0.18

mysql> create table t1(c tinyint default '11111111');
ERROR 1067 (42000): Invalid default value for 'b'

create table t1(b tinyint);
mysql> alter table t1 add column(c tinyint default '11111111');
ERROR 1067 (42000): Invalid default value for 'c'

3. What did you see instead (Required)

tidb> create table t1(b tinyint default '11111111');
Query OK, 0 rows affected, 1 warning (0.01 sec)

tidb> show warnings;
+---------+------+-------------------------------------+
| Level   | Code | Message                             |
+---------+------+-------------------------------------+
| Warning | 1690 | constant 11111111 overflows tinyint |
+---------+------+-------------------------------------+
1 row in set (0.00 sec)

tidb> alter table t1 add column(c tinyint default '11111111');
Query OK, 0 rows affected, 1 warning (0.02 sec)

4. What is your TiDB version? (Required)

master

related #51320

@zimulala zimulala added type/bug This issue is a bug. type/compatibility component/ddl This issue is related to DDL of TiDB. labels Apr 29, 2024
@zimulala zimulala self-assigned this Apr 29, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 30, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 30, 2024
3AceShowHand pushed a commit to 3AceShowHand/tidb that referenced this issue May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant