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 panic when create table patition by range columns #7379

Merged
merged 2 commits into from
Aug 13, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,8 @@ func (d *ddl) CreateTable(ctx sessionctx.Context, s *ast.CreateTableStmt) (err e
if err != nil {
return errors.Trace(err)
}
if s.Partition != nil {
// TODO: Remove the test 's.Partition.Expr != nil' when we support 'PARTITION BY RANGE COLUMNS'
if s.Partition != nil && s.Partition.Expr != nil {
pi := &model.PartitionInfo{
Type: s.Partition.Tp,
Expr: s.Partition.Expr.Text(),
Expand Down
3 changes: 3 additions & 0 deletions ddl/ddl_db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,9 @@ func (s *testDBSuite) TestCreateTableWithPartition(c *C) {
c.Assert(part.Definitions[1].Name, Equals, "p1")
c.Assert(part.Definitions[2].MaxValue, IsTrue)
c.Assert(part.Definitions[2].Name, Equals, "p2")

// Fix issue 7362.
s.tk.MustExec("create table test_partition(id bigint, name varchar(255), primary key(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8 PARTITION BY RANGE COLUMNS(id) (PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB);")
}

func (s *testDBSuite) TestTruncateTable(c *C) {
Expand Down