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

default value of column with no default value behavior is not compatible with mysql 8.0.29 #51324

Closed
crazycs520 opened this issue Feb 26, 2024 · 0 comments · Fixed by #51309
Closed
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) component/ddl This issue is related to DDL of TiDB. severity/moderate type/bug The issue is confirmed as a bug.

Comments

@crazycs520
Copy link
Contributor

crazycs520 commented Feb 26, 2024

Bug Report

I found this issue when investigating #50043

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (id int key, a int, b enum('a', 'b'));
alter table t alter column a drop default;
alter table t alter column b drop default;
insert ignore into t set id = 4;
show warnings;
insert ignore into t set id = 6, a = DEFAULT, b = DEFAULT;
show warnings;

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

From MySQL 8.0.29

the show warnings result should be:

> show warnings;
+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1364 | Field 'a' doesn't have a default value |
+---------+------+----------------------------------------+

And the table data should be:

> select * from t;
+----+--------+--------+
| id | a      | b      |
+----+--------+--------+
| 4  | <null> | <null> |
| 6  | <null> | <null> |
+----+--------+--------+

3. What did you see instead (Required)

the show warnings result is:

> show warnings;
+---------+------+---------------------------+
| Level   | Code | Message                   |
+---------+------+---------------------------+
| Warning | 1048 | Column 'a' cannot be null |
+---------+------+---------------------------+

And the table data is:

> select * from t;
+----+---+--------+
| id | a | b      |
+----+---+--------+
| 4  | 0 | <null> |
| 6  | 0 | <null> |
+----+---+--------+

4. What is your TiDB version? (Required)

+-----------------------------------------------------------+
| tidb_version()                                            |
+-----------------------------------------------------------+
| Release Version: v8.0.0-alpha-301-g1438892b9f-dirty       |
| Edition: Community                                        |
| Git Commit Hash: 1438892b9fed5efc6fae8df8d44c239368ced262 |
| Git Branch: master                                        |
| UTC Build Time: 2024-02-26 09:58:28                       |
| GoVersion: go1.21.5                                       |
| Race Enabled: false                                       |
| Check Table Before Drop: false                            |
| Store: unistore                                           |
+-----------------------------------------------------------+
@crazycs520 crazycs520 added type/bug The issue is confirmed as a bug. compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) labels Feb 26, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in e586960 Feb 28, 2024
ti-chi-bot bot pushed a commit that referenced this issue Feb 28, 2024
ti-chi-bot bot pushed a commit that referenced this issue Feb 28, 2024
ti-chi-bot bot pushed a commit that referenced this issue Mar 8, 2024
@jebter jebter added the component/ddl This issue is related to DDL of TiDB. label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) component/ddl This issue is related to DDL of TiDB. severity/moderate type/bug The issue is confirmed as a bug.
Projects
None yet
3 participants