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

unexpected duplicate error when replace into clustered primary key with prefix column with default value #23063

Closed
lysu opened this issue Mar 3, 2021 · 2 comments · Fixed by #23091
Assignees
Labels
severity/major sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.
Milestone

Comments

@lysu
Copy link
Contributor

lysu commented Mar 3, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table test1(c1 varchar(100) not null default 'xyza', c2 int, primary key(c1(3)) clustered);
replace into test1(c2) values(1);
replace into test1(c2) values(1);

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

two replace successed

3. What did you see instead (Required)

last replace failed with

replace into test1(c2) values(1);
ERROR 1062 (23000): Duplicate entry 'xyz' for key 'PRIMARY'

4. What is your TiDB version? (Required)

Release Version: v4.0.0-beta.2-2243-g7daf7436d
Edition: Community
Git Commit Hash: 7daf7436da5de4e5fea3895e892d10d3790e9102
Git Branch: master
UTC Build Time: 2021-03-03 06:18:37
GoVersion: go1.15
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@lysu lysu added the type/bug The issue is confirmed as a bug. label Mar 3, 2021
@lysu
Copy link
Contributor Author

lysu commented Mar 3, 2021

insert on duplicate without default value also have same problem

create table test3(c1 varchar(100), c2 int, primary key(c1(1)) clustered);
insert into test3 values('ab', 1) on duplicate key update c2 = 100;
insert into test3 values('ab', 1) on duplicate key update c2 = 100;
ERROR 1062 (23000): Duplicate entry 'a' for key 'PRIMARY'

@ti-srebot
Copy link
Contributor

ti-srebot commented Mar 9, 2021

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

master

6. Fixed versions

master

@jebter jebter added this to the v5.0.0 ga milestone Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants