Skip to content

Commit

Permalink
fix show create table display mistake (#6630)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhexuany authored and shenli committed May 23, 2018
1 parent bcd3750 commit 30fe526
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions executor/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,14 +633,9 @@ func (e *ShowExec) fetchShowCreateTable() error {
for i, def := range partitionInfo.Definitions {
lessThans := ""
lessThans = strings.Join(def.LessThan, ",")
multipleLt := len(def.LessThan) > 1

var parDef string
if multipleLt {
parDef = fmt.Sprintf(" PARTITION %s VALUES LESS THAN (%s)", def.Name, lessThans)
} else {
parDef = fmt.Sprintf(" PARTITION %s VALUES LESS THAN %s", def.Name, lessThans)
}
parDef = fmt.Sprintf(" PARTITION %s VALUES LESS THAN (%s)", def.Name, lessThans)
if i < len(partitionInfo.Definitions)-1 {
buf.WriteString(parDef)
buf.WriteString(",\n")
Expand Down
2 changes: 1 addition & 1 deletion executor/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,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"+"\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)",
))

tk.MustExec(`drop table if exists t`)
Expand Down

0 comments on commit 30fe526

Please sign in to comment.