Skip to content

Commit

Permalink
ddl: create partition table fail with strconv.ParseInt invalid syntax (
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao authored Apr 16, 2020
1 parent e3b635e commit 22664a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ddl/db_partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ func (s *testIntegrationSuite3) TestCreateTableWithPartition(c *C) {
tk.MustGetErrCode(`create table t34 (dt datetime) partition by range (unix_timestamp(dt)) (
partition p0 values less than (unix_timestamp('2020-04-04 00:00:00')),
partition p1 values less than (unix_timestamp('2020-04-05 00:00:00')));`, tmysql.ErrWrongExprInPartitionFunc)

// Fix https://github.com/pingcap/tidb/issues/16333
tk.MustExec(`create table t35 (dt timestamp) partition by range (unix_timestamp(dt))
(partition p0 values less than (unix_timestamp('2020-04-15 00:00:00')));`)
}

func (s *testIntegrationSuite2) TestCreateTableWithHashPartition(c *C) {
Expand Down
2 changes: 1 addition & 1 deletion ddl/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func checkPartitionFuncType(ctx sessionctx.Context, s *ast.CreateTableStmt, tblI
func checkCreatePartitionValue(ctx sessionctx.Context, tblInfo *model.TableInfo) error {
pi := tblInfo.Partition
defs := pi.Definitions
if len(defs) <= 1 {
if len(defs) == 0 {
return nil
}

Expand Down

0 comments on commit 22664a7

Please sign in to comment.