Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

Dmitry Koval <d.koval@postgrespro.ru>

From: Dmitry Koval <d.koval@postgrespro.ru>
To: jian he <jian.universality@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-07-14T08:41:30Z
Lists: pgsql-hackers

Attachments

Hi!

1.
 >this comment seems wrong?
 >it should be "does this partitioned table (parent) have a default
 >partition?

Agreed, this comment belongs to different code position. Corrected.

2.
 >This error message is not good, IMHO. I don't really have any good
 >ideas though.
 >if we polish this message later, now we can add a comment: "FIXME
 >improve this error message".

Probably it won't be possible to make the error message correct for both 
MERGE PARTITIONS and SPLIT PARTITION.
I split code for MERGE PARTITIONS and SPLIT PARTITION and now error 
messages are different for them.

3.
 >after createPartitionTable->heap_create_with_catalog do the error check
 >seems unintuitive to me.
 >it can be checked right after RangeVarGetAndCheckCreationNamespace.

I agree that these error checks are unintuitive.
But the createPartitionTable function, which contains checks, will be 
used in many places - not only for MERGE PARTITIONS, but also for SPLIT 
PARTITION. I think it's not a good idea to do the same checks in 
different places in code. Maybe it's better to do these checks in one 
place (even though it's unintuitive)?


-- 
With best regards,
Dmitry Koval

Postgres Professional: http://postgrespro.com