Skip to content
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
6 changes: 3 additions & 3 deletions pkg/executor/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -1414,9 +1414,6 @@ func constructResultOfShowCreateTable(ctx sessionctx.Context, dbName *ast.CIStr,
fmt.Fprintf(buf, " /* CACHED ON */")
}

// add partition info here.
ddl.AppendPartitionInfo(tableInfo.Partition, buf, sqlMode)

if tableInfo.TTLInfo != nil {
restoreFlags := parserformat.RestoreStringSingleQuotes | parserformat.RestoreNameBackQuotes | parserformat.RestoreTiDBSpecialComment
restoreCtx := parserformat.NewRestoreCtx(restoreFlags, buf)
Expand Down Expand Up @@ -1471,6 +1468,9 @@ func constructResultOfShowCreateTable(ctx sessionctx.Context, dbName *ast.CIStr,
return err
}
}

// add partition info here.
ddl.AppendPartitionInfo(tableInfo.Partition, buf, sqlMode)
return nil
}

Expand Down
10 changes: 10 additions & 0 deletions tests/integrationtest/r/show.result
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@ show tables like '%xx';
Tables_in_show (%xx)
show databases like '%xx';
Database (%xx)
drop table if exists t;
create table t (id int, created_time datetime) TTL=created_time + interval 1 hour partition by range columns(id) (partition p1 values less than (100));
show create table t;
Table Create Table
t CREATE TABLE `t` (
`id` int DEFAULT NULL,
`created_time` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![ttl] TTL=`created_time` + INTERVAL 1 HOUR */ /*T![ttl] TTL_ENABLE='ON' */ /*T![ttl] TTL_JOB_INTERVAL='24h' */
PARTITION BY RANGE COLUMNS(`id`)
(PARTITION `p1` VALUES LESS THAN (100))
5 changes: 5 additions & 0 deletions tests/integrationtest/t/show.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ set tidb_cost_model_version=1;
# test show output field name
show tables like '%xx';
show databases like '%xx';

# test show TTL and Partition table
drop table if exists t;
create table t (id int, created_time datetime) TTL=created_time + interval 1 hour partition by range columns(id) (partition p1 values less than (100));
show create table t;