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

tidb allows NULL value to NOT NULL column #57435

Open
mzhang77 opened this issue Nov 17, 2024 · 0 comments
Open

tidb allows NULL value to NOT NULL column #57435

mzhang77 opened this issue Nov 17, 2024 · 0 comments
Labels
type/bug The issue is confirmed as a bug.

Comments

@mzhang77
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> select @@sql_mode;
+------------+
| @@sql_mode |
+------------+
|            |
+------------+
1 row in set (0.00 sec)

mysql> create table t( pk int primary key not null auto_increment, data binary(12) not null);
Query OK, 0 rows affected (0.06 sec)

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

mysql> select * from t;
+----+----------------------------+
| pk | data                       |
+----+----------------------------+
|  1 | 0x000000000000000000000000 |
+----+----------------------------+
1 row in set (0.00 sec)

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

Tidb should not allow insert of NULL value to NOT NULL column. See below mysql result:

mysql> select @@sql_mode;
+------------+
| @@sql_mode |
+------------+
|            |
+------------+
1 row in set (0.00 sec)

mysql> create table t( pk int primary key not null auto_increment, data binary(12) not null);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t(data) values (null);
ERROR 1048 (23000): Column 'data' cannot be null
mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 8.0.40    |
+-----------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

tidb allows insert of NULL value to NOT NULL column, it's incompatible with mysql

4. What is your TiDB version? (Required)

mysql> select @@version;
+--------------------+
| @@version          |
+--------------------+
| 8.0.11-TiDB-v7.5.3 |
+--------------------+
1 row in set (0.00 sec)
@mzhang77 mzhang77 added the type/bug The issue is confirmed as a bug. label Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

1 participant