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

can insert null value into not null column #55457

Closed
yiduoyunQ opened this issue Aug 16, 2024 · 1 comment · Fixed by #55477
Closed

can insert null value into not null column #55457

yiduoyunQ opened this issue Aug 16, 2024 · 1 comment · Fixed by #55477
Labels
severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@yiduoyunQ
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set session sql_mode = '';
create table a (id int primary key,b  varchar(10) not null default '');
insert into a values(4, null);

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

mysql> insert into a values(4, null);
ERROR 1146 (42S02): Table 'test.a' doesn't exist

3. What did you see instead (Required)

mysql> set session sql_mode = '';
Query OK, 0 rows affected (0.00 sec)

mysql> create table a (id int primary key,b  varchar(10) not null default '');
Query OK, 0 rows affected (0.09 sec)

mysql> insert into a values(4, null);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+---------------------------+
| Level   | Code | Message                   |
+---------+------+---------------------------+
| Warning | 1048 | Column 'b' cannot be null |
+---------+------+---------------------------+
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

all version has this issue

mysql> select version();
+--------------------+
| version()          |
+--------------------+
| 8.0.11-TiDB-v8.1.0 |
+--------------------+
1 row in set (0.00 sec)
@yiduoyunQ yiduoyunQ added the type/bug The issue is confirmed as a bug. label Aug 16, 2024
@yiduoyunQ
Copy link
Author

mysql behaviour is correct

mysql v8.3
img_v3_02dp_06ad7a4f-0b6f-40cc-b660-3484b7507d3g

mysql v5.7
img_v3_02dp_70e3c2fe-e44a-422b-9697-13cfc3c0d2eg

@ti-chi-bot ti-chi-bot bot closed this as completed in 91beef4 Nov 19, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this issue Nov 20, 2024
ti-chi-bot bot pushed a commit that referenced this issue Nov 21, 2024
ti-chi-bot bot pushed a commit that referenced this issue Dec 11, 2024
… non-strict mode | tidb-test=pr/2445 (#55477) (#58044)

close #55457, close #56381, close #57435
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
2 participants