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:
@ -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)));
|
||||
|
@ -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"
|
@ -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
|
||||
|
23
src/test/regress/sql/hw_partition_interval_check_syntax.sql
Normal file
23
src/test/regress/sql/hw_partition_interval_check_syntax.sql
Normal 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')
|
||||
);
|
Reference in New Issue
Block a user