diff --git a/src/gausskernel/optimizer/commands/tablecmds.cpp b/src/gausskernel/optimizer/commands/tablecmds.cpp index ca96430061b401202c15975f3d20ab18cc534329..0eae0f4fd8f560dd3a963efbebc69caab6321ab3 100755 --- a/src/gausskernel/optimizer/commands/tablecmds.cpp +++ b/src/gausskernel/optimizer/commands/tablecmds.cpp @@ -30600,9 +30600,10 @@ static void checkSplitPointForSplit(SplitPartitionState* splitPart, Relation par splitPart->split_point = transformRangePartitionValueInternal(pstate, splitPart->split_point, true, true); pfree_ext(pstate); + bool partkeyIsFunc = IsPartKeyFunc(partTableRel, false, partTableRel->parentId != InvalidOid); List *tmp = splitPart->split_point; - splitPart->split_point = - transformConstIntoTargetType(partTableRel->rd_att->attrs, partMap->base.partitionKey, splitPart->split_point); + splitPart->split_point = transformConstIntoTargetType(partTableRel->rd_att->attrs, partMap->base.partitionKey, + splitPart->split_point, partkeyIsFunc); list_free_ext(tmp); foreach (cell, splitPart->split_point) { @@ -33425,7 +33426,8 @@ void CreateWeakPasswordDictionary(CreateWeakPasswordDictionaryStmt* stmt) values[Anum_gs_global_config_name - 1] = DirectFunctionCall1(namein, CStringGetDatum(name)); values[Anum_gs_global_config_value - 1] = CStringGetTextDatum(pwd); tup = (HeapTuple) heap_form_tuple(RelationGetDescr(rel), values, nulls); - simple_heap_insert(rel, tup); + simple_heap_insert(rel, tup); + heap_freetuple_ext(tup); } } heap_close(rel, RowExclusiveLock); diff --git a/src/test/regress/input/partition_expr_key.source b/src/test/regress/input/partition_expr_key.source index f8fa9eb6832c7f07b9fef9d495b93a9212144c88..9a67f7dc66303c189ae1c6ab531faf6cc7a3f8d3 100644 --- a/src/test/regress/input/partition_expr_key.source +++ b/src/test/regress/input/partition_expr_key.source @@ -398,6 +398,23 @@ select * from test_exprkey_move_part; update test_exprkey_move_part set a=1001 where a=1000; select * from test_exprkey_move_part; +-- test split expkey partition +DROP TABLE IF EXISTS tb1 cascade; +CREATE TABLE tb1 ( + id serial NOT NULL, + inqueuetime timestamp NOT NULL, + url_count int NOT NULL DEFAULT 0, + constraint tb1_id_inqueuetime_pk primary key(id,inqueuetime) +) +PARTITION BY RANGE (date_part('year', inqueuetime))( + PARTITION p1 VALUES LESS THAN (2000), + PARTITION p4 VALUES LESS THAN (maxvalue) +); +alter table tb1 split partition p4 at(2001) into (partition p5,partition p6); + +-- test split expkey partition with updating index +alter table tb1 split partition p1 at(1000) into (partition p11,partition p12) update global index; + \c regression drop database if exists part_expr_key_db; diff --git a/src/test/regress/output/partition_expr_key.source b/src/test/regress/output/partition_expr_key.source index a4592cdc90c0f8d515a99b2984094f95d812030f..3e4de25624a3608582a0ad51101354a7e296b222 100644 --- a/src/test/regress/output/partition_expr_key.source +++ b/src/test/regress/output/partition_expr_key.source @@ -1280,6 +1280,25 @@ select * from test_exprkey_move_part; 1001 | 1 (1 row) +-- test split expkey partition +DROP TABLE IF EXISTS tb1 cascade; +NOTICE: table "tb1" does not exist, skipping +CREATE TABLE tb1 ( + id serial NOT NULL, + inqueuetime timestamp NOT NULL, + url_count int NOT NULL DEFAULT 0, + constraint tb1_id_inqueuetime_pk primary key(id,inqueuetime) +) +PARTITION BY RANGE (date_part('year', inqueuetime))( + PARTITION p1 VALUES LESS THAN (2000), + PARTITION p4 VALUES LESS THAN (maxvalue) +); +NOTICE: CREATE TABLE will create implicit sequence "tb1_id_seq" for serial column "tb1.id" +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tb1_id_inqueuetime_pk" for table "tb1" +alter table tb1 split partition p4 at(2001) into (partition p5,partition p6); +NOTICE: Command without UPDATE GLOBAL INDEX will disable global index +-- test split expkey partition with updating index +alter table tb1 split partition p1 at(1000) into (partition p11,partition p12) update global index; \c regression drop database if exists part_expr_key_db; drop database if exists part_expr_key_db1;