-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
REPLACE overwrites other rows when auto_inc capacity exceeded #29483
Comments
This is actually a serious bug. So the MySQL behavior is quite clear: For TiDB: |
Here is a simplified case against master: SET sql_mode="NO_ENGINE_SUBSTITUTION";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a tinyint not null auto_increment primary key, b char(20));
INSERT INTO t1 VALUES (127,"maxvalue");
REPLACE INTO t1 VALUES (0,"newmaxvalue");
SHOW WARNINGS;
SELECT * FROM t1;
..
tidb> REPLACE INTO t1 VALUES (0,"newmaxvalue");
Query OK, 2 rows affected, 1 warning (0.01 sec)
tidb> SHOW WARNINGS;
+---------+------+--------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------+
| Warning | 1690 | constant 128 overflows tinyint |
+---------+------+--------------------------------+
1 row in set (0.00 sec)
tidb> SELECT * FROM t1;
+-----+-------------+
| a | b |
+-----+-------------+
| 127 | newmaxvalue |
+-----+-------------+
1 row in set (0.00 sec) This does not work on the default SQL mode, but it is still problematic because it changes unrelated rows. |
Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label. |
update issue |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: