diff --git a/ddl/db_partition_test.go b/ddl/db_partition_test.go index 39c21b0831df5..f67365adc8736 100644 --- a/ddl/db_partition_test.go +++ b/ddl/db_partition_test.go @@ -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) { diff --git a/ddl/partition.go b/ddl/partition.go index 01e0092289489..366b025167782 100644 --- a/ddl/partition.go +++ b/ddl/partition.go @@ -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 }