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

ddl: fix add unique index on partitioned table (by RANGE COLUMNS) failed (#11946) #11958

Merged
merged 3 commits into from
Aug 30, 2019

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Aug 30, 2019

cherry-pick #11946 to release-3.0


Signed-off-by: Lonng heng@lonng.org

What problem does this PR solve?

create table t(
    a int,
    b varchar(100),
    c int,
    INDEX idx_c(c))
PARTITION BY RANGE COLUMNS( a ) (
    PARTITION p0 VALUES LESS THAN (6),
    PARTITION p1 VALUES LESS THAN (11),
    PARTITION p2 VALUES LESS THAN (16),
    PARTITION p3 VALUES LESS THAN (21)
);
mysql> alter table t add unique index idx_a(a);
ERROR 1105 (HY000): line 1 column 7 near ""

What is changed and how it works?

The Expr field in PartitionInfo is not always be assigned a value (e.g: PARTITION BY RANGE COLUMNS(...)).
This PR use columns in PartitionInfo directly if the PartitionInfo.Expr is an empty string.

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)

Related changes

  • Need to cherry-pick to the release branch

Release note

  • Fix add unique index on the partitioned table (by RANGE COLUMNS(...)) failed.

Signed-off-by: Lonng <heng@lonng.org>
Signed-off-by: Lonng <heng@lonng.org>
@sre-bot
Copy link
Contributor Author

sre-bot commented Aug 30, 2019

/run-all-tests

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 30, 2019
Copy link
Contributor

@tangenta tangenta left a comment

Choose a reason for hiding this comment

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

LGTM

@tangenta tangenta added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Aug 30, 2019
@winkyao winkyao merged commit 1f87310 into pingcap:release-3.0 Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants