public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tender Wang <[email protected]>
To: Alexander Korotkov <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: Sat, 20 Dec 2025 11:18:16 +0800
Message-ID: <CAHewXNmBM+5qbrJMu60NxPn+0y-=2wXM-QVVs3xRp8NxFvDb9A@mail.gmail.com> (raw)
In-Reply-To: <CAPpHfdu8wPv6hes7v95fF__N1pkPG1yS3YumKUGmS_jdF2RtrA@mail.gmail.com>
References: <171085360143.2046436.7217841141682511557.pgcf@coridan.postgresql.org>
<CAPpHfdsh_jPZ6-2JtWoFeZravVQYY4cYCcnKXQW6KxEx+F5vxg@mail.gmail.com>
<[email protected]>
<CACJufxF1Hfx1PST7pCLrKkGcjHEn2A51znXmYwVccnt5GDORcw@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<CACJufxET9Qe-=zJtjGrKPr7-1QbVcP9y-vJU9CMEDfPGt_dbyg@mail.gmail.com>
<[email protected]>
<CACJufxEBvrtcOWyX2NMwOCvb2ZvaRGaGeiMQpUD=yxL6ncBFOg@mail.gmail.com>
<[email protected]>
<CAPpHfdvSBR+sbsRCAybN949tOGArQvMH2QeDXf2L=7NDMNbJfw@mail.gmail.com>
<[email protected]>
<CAPpHfduQwwa4ytK-dGjRGN0fTWfpWNNysYuUKrOetsyGioBMfA@mail.gmail.com>
<[email protected]>
<CAPpHfdvpzezTnuumpdJYge=x1TbhgAkjMGh2GHnScf5SFsf2ew@mail.gmail.com>
<[email protected]>
<CAPpHfdtBH5YhAiKhXPcLAE4CCRMaGKqupzx8u2RKEm2aQ_e3Xw@mail.gmail.com>
<CA+gpmfLSELzEKEzSFXeLkRRMGkRfm2+7ewXHyW-8ZWPbWOywyg@mail.gmail.com>
<CAPpHfdtnWkesztu4qq1m8RfuR2OYXd5tbPyaHk-3Db2szWrb=Q@mail.gmail.com>
<CAPpHfdta0DMb3XjePJJWf1xbAndE8w2uYPaWEOFBGQ=xsDkfiQ@mail.gmail.com>
<[email protected]>
<CAPpHfdvt64X0F3thjC0q9vOTU-JqG2M_MJfEeA2-_=odNOA3Dg@mail.gmail.com>
<[email protected]>
<CAPpHfdu8wPv6hes7v95fF__N1pkPG1yS3YumKUGmS_jdF2RtrA@mail.gmail.com>
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
Attachments:
[application/octet-stream] 0001-Adjust-errcode-in-checkPartition.patch (987B, ../CAHewXNmBM+5qbrJMu60NxPn+0y-=2wXM-QVVs3xRp8NxFvDb9A@mail.gmail.com/3-0001-Adjust-errcode-in-checkPartition.patch)
download | inline diff:
From 676cde81fda01233ef707761334d6d59c906efe2 Mon Sep 17 00:00:00 2001
From: Tender Wang <[email protected]>
Date: Sat, 20 Dec 2025 10:56:36 +0800
Subject: [PATCH] Adjust errcode in checkPartition().
Replace ERRCODE_UNDEFINED_TABLE with ERRCODE_WRONG_OBJECT_TYPE.
---
src/backend/parser/parse_utilcmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 2b7b084f216..3abe5410b4c 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -3544,7 +3544,7 @@ checkPartition(Relation rel, Oid partRelOid, bool isMerge)
if (get_partition_parent(partRelOid, false) != RelationGetRelid(rel))
ereport(ERROR,
- errcode(ERRCODE_UNDEFINED_TABLE),
+ errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("relation \"%s\" is not a partition of relation \"%s\"",
RelationGetRelationName(partRel), RelationGetRelationName(rel)),
isMerge
--
2.34.1
view thread (165+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
In-Reply-To: <CAHewXNmBM+5qbrJMu60NxPn+0y-=2wXM-QVVs3xRp8NxFvDb9A@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox