fix the issue: the process crashs when an interval parition table is created with integer interval value

Signed-off-by: yujiang <wutheringwind@163.com>
This commit is contained in:
yujiang
2020-08-03 14:21:52 +08:00
parent bc7e4b2d87
commit 3ed26a5479
4 changed files with 50 additions and 1 deletions

View File

@ -4199,7 +4199,8 @@ void checkPartitionSynax(CreateStmt* stmt)
errmsg("Range partitioned table with INTERVAL clause has more than one column"),
errhint("Only support one partition key for interval partition")));
}
if (!IsA(stmt->partTableState->intervalPartDef->partInterval, A_Const)) {
if (!IsA(stmt->partTableState->intervalPartDef->partInterval, A_Const) ||
((A_Const*)stmt->partTableState->intervalPartDef->partInterval)->val.type != T_String) {
ereport(ERROR,
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
// errmsg("invalid input syntax for type %s: \"%s\"", datatype, str)));

View File

@ -0,0 +1,24 @@
create table partiton_table_001(
COL_1 bigint,
COL_2 TIMESTAMP WITHOUT TIME ZONE,
COL_3 bool,
COL_4 decimal
)
PARTITION BY RANGE (COL_4)
INTERVAL (10000)
(
PARTITION partiton_table_001_p1 VALUES LESS THAN (1000)
);
ERROR: invalid input syntax for type interval
create table partiton_table_001(
COL_1 bigint,
COL_2 TIMESTAMP WITHOUT TIME ZONE,
COL_3 bool,
COL_4 decimal
)
PARTITION BY RANGE (COL_2)
INTERVAL ('2018-1-1')
(
PARTITION partiton_table_001_p1 VALUES LESS THAN ('2020-03-01')
);
ERROR: invalid input syntax for type interval: "2018-1-1"

View File

@ -17,6 +17,7 @@ test: hw_partition_interval_parallel_prepare
test: hw_partition_interval_parallel_insert hw_partition_interval_parallel_insert_01 hw_partition_interval_parallel_insert_02
test: hw_partition_interval_parallel_end
test: hw_partition_interval_select
test: hw_partition_interval_check_syntax
#test: hw_partition_lock
#test: hw_partition_llt
# FIXME: move me back to the parallel test when the refcnt issue is fixed

View File

@ -0,0 +1,23 @@
create table partiton_table_001(
COL_1 bigint,
COL_2 TIMESTAMP WITHOUT TIME ZONE,
COL_3 bool,
COL_4 decimal
)
PARTITION BY RANGE (COL_4)
INTERVAL (10000)
(
PARTITION partiton_table_001_p1 VALUES LESS THAN (1000)
);
create table partiton_table_001(
COL_1 bigint,
COL_2 TIMESTAMP WITHOUT TIME ZONE,
COL_3 bool,
COL_4 decimal
)
PARTITION BY RANGE (COL_2)
INTERVAL ('2018-1-1')
(
PARTITION partiton_table_001_p1 VALUES LESS THAN ('2020-03-01')
);