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

update a unsigned column with "-1" result a NULL value when sql_mode='' #47816

Closed
lcwangchao opened this issue Oct 19, 2023 · 0 comments · Fixed by #47817
Closed

update a unsigned column with "-1" result a NULL value when sql_mode='' #47816

lcwangchao opened this issue Oct 19, 2023 · 0 comments · Fixed by #47817
Labels
affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 affects-7.5 severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@lcwangchao
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

> create table t1(a int unsigned);
> set sql_mode='';
> insert into t1 values(0);
> update t1 set a = '-1';
> select a from t1;

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

In MySQL 8.0, it inserts a 0 value:

mysql> select a from t1;
+------+
| a    |
+------+
|    0 |
+------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

In tidb, the updated value is NULL.

TiDB root@127.0.0.1:test> select a from t1;
+--------+
| a      |
+--------+
| <null> |
+--------+
1 row in set
Time: 0.009s

4. What is your TiDB version? (Required)

master, but I think it affects all versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 affects-7.5 severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants