Skip to content

ddl, executor: fix clustered prefix primary key truncation#19320

Merged
coocood merged 3 commits intopingcap:masterfrom
tangenta:cluster-index-fix-truncation
Aug 20, 2020
Merged

ddl, executor: fix clustered prefix primary key truncation#19320
coocood merged 3 commits intopingcap:masterfrom
tangenta:cluster-index-fix-truncation

Conversation

@tangenta
Copy link
Contributor

What problem does this PR solve?

Problem Summary:

  • In UpdateRecord, the updating common handle should be truncated. Otherwise, the update-ignore statement fails to throw a warning.
drop table if exists t;
set tidb_enable_clustered_index=1;
create table t(a varchar(255), b int, primary key (a(2)));
insert into t values ('aaa', 1), ('bbb', 1);
update ignore t set a = 'aaaaa' where a = 'bbb';
show warnings;

Expected

+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1062 | Duplicate entry 'aa' for key 'PRIMARY' |
+---------+------+----------------------------------------+

Got

+-------+------+---------+
| Level | Code | Message |
+-------+------+---------+

What is changed and how it works?

What's Changed: Truncate the updating common handle if necessary.

How it Works: Omitted.

Related changes

N/A

Check List

Tests

  • Unit test
  • Integration test

Side effects

N/A

Release note

  • No release note

@tangenta tangenta added the sig/sql-infra SIG: SQL Infra label Aug 20, 2020
@tangenta tangenta requested a review from a team as a code owner August 20, 2020 06:14
@tangenta tangenta requested review from lzmhhh123 and removed request for a team August 20, 2020 06:14
@coocood coocood added the sig/execution SIG execution label Aug 20, 2020
@coocood
Copy link
Member

coocood commented Aug 20, 2020

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 20, 2020
Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Aug 20, 2020
@lzmhhh123
Copy link
Contributor

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 20, 2020
@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@tangenta merge failed.

@coocood coocood merged commit 13bd62e into pingcap:master Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sig/execution SIG execution sig/sql-infra SIG: SQL Infra status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants