Skip to content

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

Merged
sre-bot merged 5 commits into
pingcap:masterfrom
lonng:fix-partition-range-col
Aug 30, 2019
Merged

ddl: fix add unique index on partitioned table (by RANGE COLUMNS) failed#11946
sre-bot merged 5 commits into
pingcap:masterfrom
lonng:fix-partition-range-col

Conversation

@lonng
Copy link
Copy Markdown
Contributor

@lonng lonng commented Aug 30, 2019

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.

@lonng
Copy link
Copy Markdown
Contributor Author

lonng commented Aug 30, 2019

/run-all-tests

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 30, 2019

Codecov Report

Merging #11946 into master will decrease coverage by 0.1333%.
The diff coverage is 76.4705%.

@@               Coverage Diff                @@
##             master     #11946        +/-   ##
================================================
- Coverage   81.3468%   81.2134%   -0.1334%     
================================================
  Files           443        443                
  Lines         95035      95015        -20     
================================================
- Hits          77308      77165       -143     
- Misses        12267      12356        +89     
- Partials       5460       5494        +34

Comment thread ddl/partition.go Outdated
@lonng lonng changed the title ddl: fix add unique index on the table which partitioned by range columns ddl: fix add unique index on partitioned table (by range columns) failed Aug 30, 2019
@lonng lonng changed the title ddl: fix add unique index on partitioned table (by range columns) failed ddl: fix add unique index on partitioned table (by RANGE COLUMNS) failed Aug 30, 2019
Comment thread ddl/db_integration_test.go
lonng added 3 commits August 30, 2019 15:12
Signed-off-by: Lonng <heng@lonng.org>
Signed-off-by: Lonng <heng@lonng.org>
@tiancaiamao
Copy link
Copy Markdown
Contributor

LGTM

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

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala 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
Copy link
Copy Markdown
Contributor

@crazycs520 crazycs520 left a comment

Choose a reason for hiding this comment

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

LGTM

@lonng lonng added the status/can-merge Indicates a PR has been approved by a committer. label Aug 30, 2019
@sre-bot
Copy link
Copy Markdown
Contributor

sre-bot commented Aug 30, 2019

/run-all-tests

@sre-bot sre-bot merged commit 25e134c into pingcap:master Aug 30, 2019
@lonng lonng deleted the fix-partition-range-col branch August 30, 2019 08:03
@sre-bot
Copy link
Copy Markdown
Contributor

sre-bot commented Aug 30, 2019

cherry pick to release-3.0 failed

@lonng
Copy link
Copy Markdown
Contributor Author

lonng commented Aug 30, 2019

Cherry-pick to release-3.0 after #11954 merged

@you06
Copy link
Copy Markdown
Contributor

you06 commented Aug 30, 2019

/run-cherry-picker

@sre-bot
Copy link
Copy Markdown
Contributor

sre-bot commented Aug 30, 2019

cherry pick to release-3.0 in PR #11958

@you06 you06 added the sig/sql-infra SIG: SQL Infra label Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

6 participants