Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Tender Wang <tndrwang@gmail.com>
From: Tender Wang <tndrwang@gmail.com>
To: Alexander Korotkov <aekorotkov@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-12-20T03:18:16Z
Lists: pgsql-hackers
Attachments
- 0001-Adjust-errcode-in-checkPartition.patch (application/octet-stream)
Hi Alexander,
I found this feature merged; thanks for this work.
I tested it and found that one place in the error errcode may need to be
changed.
In checkPartition():
...
if (get_partition_parent(partRelOid, false) != RelationGetRelid(rel))
ereport(ERROR,
errcode(ERRCODE_UNDEFINED_TABLE),
errmsg("relation \"%s\" is not a partition of relation \"%s\"",
...
ERRCODE_UNDEFINED_TABLE usually means "table does not exist."
When entering here, the table should exist, otherwise table_open() already
reports an error.
I found another two errcode in checkPartition()
use ERRCODE_WRONG_OBJECT_TYPE,
In the attached patch, I replace ERRCODE_UNDEFINED_TABLE with
ERRCODE_WRONG_OBJECT_TYPE.
--
Thanks,
Tender Wang