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

parser: make "ENGINE = xxx" optional in partition definition #3140

Merged
merged 2 commits into from
Apr 25, 2017

Conversation

tiancaiamao
Copy link
Contributor

CREATE TABLE t (
    `id` bigint(20) unsigned NOT NULL auto_increment COMMENT '',
    `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
    PRIMARY KEY(`id`, `create_time`),
    INDEX `idx_cid`(`content_id`)
) engine= InnoDB DEFAULT CHARSET= `utf8` DEFAULT COLLATE `utf8_general_ci` comment= '' PARTITION BY Range (UNIX_TIMESTAMP(create_time)
)(PARTITION p201610 VALUES LESS THAN(1477929600),
    PARTITION p201611 VALUES LESS THAN(1480521600),
    PARTITION p201612 VALUES LESS THAN(1483200000),
    PARTITION p201701 VALUES LESS THAN(1485878400),
    PARTITION p201702 VALUES LESS THAN(1488297600),
    PARTITION p201703 VALUES LESS THAN(1490976000),
    PARTITION p201704 VALUES LESS THAN(1493568000),
    PARTITION p201705 VALUES LESS THAN(1496246400),
    PARTITION p201706 VALUES LESS THAN(1498838400),
    PARTITION p201707 VALUES LESS THAN(1501516800),
    PARTITION p201708 VALUES LESS THAN(1504195200),
    PARTITION p201709 VALUES LESS THAN(1506787200),
    PARTITION p201710 VALUES LESS THAN(1509465600),
    PARTITION p201711 VALUES LESS THAN(1512057600),
    PARTITION p201712 VALUES LESS THAN(1514736000)
)

The above SQL gramma would fail without engine specified:

    PARTITION p201704 VALUES LESS THAN(1493568000) ENGINE = InnoDB,
    PARTITION p201705 VALUES LESS THAN(1496246400) ENGINE = InnoDB,
    PARTITION p201706 VALUES LESS THAN(1498838400) ENGINE = InnoDB,
    PARTITION p201707 VALUES LESS THAN(1501516800) ENGINE = InnoDB,
    PARTITION p201708 VALUES LESS THAN(1504195200) ENGINE = InnoDB,

This PR is a fix.

@shenli
Copy link
Member

shenli commented Apr 25, 2017

LGTM

Copy link
Member

@coocood coocood left a comment

Choose a reason for hiding this comment

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

LGTM

@tiancaiamao tiancaiamao merged commit 31d2cc8 into master Apr 25, 2017
@tiancaiamao tiancaiamao deleted the tiancaiamao/parse-partition branch April 25, 2017 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants