Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
От | Alexander Korotkov |
---|---|
Тема | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands |
Дата | |
Msg-id | CAPpHfdugpFGUk-udjcroJLi6_5ypS9-3CxoC+MbRvpjncDy11w@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands (Dmitry Koval <d.koval@postgrespro.ru>) |
Ответы |
Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
|
Список | pgsql-hackers |
Hi Dmitry!
On Wed, Jun 4, 2025 at 10:44 PM Dmitry Koval <d.koval@postgrespro.ru> wrote:
> Thank you very much for review.
Thank you for your work on this patch. I have some additional notes on this patch.
Why don't you use *existing_relation_id argument of RangeVarGetAndCheckCreationNamespace(), when it is called from createPartitionTable() and ATExecSplitPartition()? This argument provide an elegant way to find a duplicate table with the same name.
It also seems that 0002 patch has the following error message, which aren't experienced in the regression tests.
+ datum = list_nth(spec->upperdatums, abs(cmpval) - 1);
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("upper bound of partition \"%s\" is not equal to upper bound of split partition",
+ relname),
+ parser_errposition(pstate, datum->location));
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("new partition \"%s\" cannot have this value because split partition does not have",
+ relname),
+ parser_errposition(pstate, overlap_location));
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("new partitions do not have value %s but split partition does",
+ searchNull ? "NULL" : get_list_partvalue_string(notFoundVal)));
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("DEFAULT partition should be one"),
+ parser_errposition(pstate, sps->name->location));
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("one partition in the list should be DEFAULT because split partition is DEFAULT"),
+ parser_errposition(pstate, ((SinglePartitionSpec *) linitial(partlist))->name->location));
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("new partition cannot be DEFAULT because DEFAULT partition already exists"),
+ parser_errposition(pstate, spsDef->name->location));
+ ereport(ERROR,
+ errcode(ERRCODE_CHECK_VIOLATION),
+ errmsg("can not find partition for split partition row"),
+ errtable(splitRel));
------
Regards,
Alexander Korotkov
Supabase
On Wed, Jun 4, 2025 at 10:44 PM Dmitry Koval <d.koval@postgrespro.ru> wrote:
> Thank you very much for review.
Thank you for your work on this patch. I have some additional notes on this patch.
Why don't you use *existing_relation_id argument of RangeVarGetAndCheckCreationNamespace(), when it is called from createPartitionTable() and ATExecSplitPartition()? This argument provide an elegant way to find a duplicate table with the same name.
It also seems that 0002 patch has the following error message, which aren't experienced in the regression tests.
+ datum = list_nth(spec->upperdatums, abs(cmpval) - 1);
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("upper bound of partition \"%s\" is not equal to upper bound of split partition",
+ relname),
+ parser_errposition(pstate, datum->location));
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("new partition \"%s\" cannot have this value because split partition does not have",
+ relname),
+ parser_errposition(pstate, overlap_location));
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("new partitions do not have value %s but split partition does",
+ searchNull ? "NULL" : get_list_partvalue_string(notFoundVal)));
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("DEFAULT partition should be one"),
+ parser_errposition(pstate, sps->name->location));
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("one partition in the list should be DEFAULT because split partition is DEFAULT"),
+ parser_errposition(pstate, ((SinglePartitionSpec *) linitial(partlist))->name->location));
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("new partition cannot be DEFAULT because DEFAULT partition already exists"),
+ parser_errposition(pstate, spsDef->name->location));
+ ereport(ERROR,
+ errcode(ERRCODE_CHECK_VIOLATION),
+ errmsg("can not find partition for split partition row"),
+ errtable(splitRel));
------
Regards,
Alexander Korotkov
Supabase
В списке pgsql-hackers по дате отправления: