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

executor: drop partition information in 'show create table' #7388

Merged
merged 2 commits into from
Aug 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 3 additions & 17 deletions executor/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,23 +589,9 @@ func (e *ShowExec) fetchShowCreateTable() error {
buf.WriteString(fmt.Sprintf(" DEFAULT CHARSET=%s COLLATE=%s", charsetName, collate))
}

// add partition info here.
partitionInfo := tb.Meta().Partition
if partitionInfo != nil {
buf.WriteString(fmt.Sprintf("\nPARTITION BY %s ( %s ) (\n", partitionInfo.Type.String(), partitionInfo.Expr))
for i, def := range partitionInfo.Definitions {
if i < len(partitionInfo.Definitions)-1 {
buf.WriteString(fmt.Sprintf(" PARTITION %s VALUES LESS THAN %s,\n", def.Name, def.LessThan[0]))
} else {
if def.MaxValue {
buf.WriteString(fmt.Sprintf(" PARTITION %s VALUES LESS THAN %s\n", def.Name, "MAXVALUE"))
} else {
buf.WriteString(fmt.Sprintf(" PARTITION %s VALUES LESS THAN %s\n", def.Name, def.LessThan[0]))
}
}
}
buf.WriteString(")")
}
// Partition info is truncated in release-2.0 branch.
// create table t (id int) partition by ... will become
// create table t (id int)

if hasAutoIncID {
autoIncID, err := tb.Allocator(e.ctx).NextGlobalAutoID(tb.Meta().ID)
Expand Down
3 changes: 1 addition & 2 deletions executor/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,7 @@ func (s *testSuite) TestShow(c *C) {
tk.MustQuery("show create table t").Check(testutil.RowsWithSep("|",
"t CREATE TABLE `t` (\n"+
" `a` int(11) DEFAULT NULL\n"+
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin"+"\nPARTITION BY RANGE ( `a` ) (\n PARTITION p0 VALUES LESS THAN 10,\n PARTITION p1 VALUES LESS THAN 20,\n PARTITION p2 VALUES LESS THAN MAXVALUE\n)",
))
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin"))
}

func (s *testSuite) TestShowVisibility(c *C) {
Expand Down