public inbox for [email protected]
help / color / mirror / Atom feedFrom: jian he <[email protected]>
To: Dmitry Koval <[email protected]>
Cc: Alexander Korotkov <[email protected]>
Cc: [email protected]
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: Thu, 21 Aug 2025 10:53:27 +0800
Message-ID: <CACJufxGh=L6YPr37Y4t+ZfReBeWdv8aiNEk7VoyhYyP7d6L-4w@mail.gmail.com> (raw)
In-Reply-To: <CACJufxGEa6ZxP6d5VjZ6-Rpx=+u9zEE9ioRZRqQ=d_HYY6+daQ@mail.gmail.com>
References: <171085360143.2046436.7217841141682511557.pgcf@coridan.postgresql.org>
<CACJufxHakPGgUHfe4uThY2u_Hzq3YOP9m4B3gjZUTUm2mbVryA@mail.gmail.com>
<CACJufxHo0u=PzgCn88VZEW0mtB=JopchqBTESudUMH+HCyiTpg@mail.gmail.com>
<[email protected]>
<CACJufxFTiAiN_27FzAE60Hm5yQ124EJ+b1dpNDstcSdCApFzLw@mail.gmail.com>
<[email protected]>
<CACJufxHjpdeDtOsmz9TyGX7jFU73LBEjX=JQpRQdAvDadT0coA@mail.gmail.com>
<[email protected]>
<CACJufxGSwvUwu2gyZfTzv=3TJ8Zu4=Kq-GB_pg3x5_5dpwYQkA@mail.gmail.com>
<[email protected]>
<CACJufxHM0sD8opy2hUxXLcdY3CQOCaMfsQtJs7yF3TS2YxSqKg@mail.gmail.com>
<[email protected]>
<CACJufxEWtK3utKjd7yMxRTGE54dJ8B+uigqvt1ocA4Q1mQ8qiQ@mail.gmail.com>
<[email protected]>
<CAPpHfdsW5_rFLwTfkYuG42nX5RbJCVhaC2vkn8p5GsT8Lseuyw@mail.gmail.com>
<[email protected]>
<CACJufxGEa6ZxP6d5VjZ6-Rpx=+u9zEE9ioRZRqQ=d_HYY6+daQ@mail.gmail.com>
On Wed, Aug 20, 2025 at 5:22 PM jian he <[email protected]> wrote:
>
> this time, I only checked
> v52-0001-Implement-ALTER-TABLE-.-MERGE-PARTITIONS-.-comma.patch
>
> typedef struct PartitionCmd
> {
> NodeTag type;
> RangeVar *name; /* name of partition to attach/detach/merge */
> PartitionBoundSpec *bound; /* FOR VALUES, if attaching */
> List *partlist; /* list of partitions, for MERGE PARTITION
> * command */
> bool concurrent;
> } PartitionCmd;
/*
* PartitionCmd - info for ALTER TABLE/INDEX ATTACH/DETACH PARTITION commands
*/
typedef struct PartitionCmd
the above comments also need to be updated?
+-- Use indexscan for testing indexes after merging partitions
+SET enable_seqscan = OFF;
+
+SELECT * FROM sales_all WHERE sales_state = 'Warsaw';
+SELECT * FROM sales_list WHERE sales_state = 'Warsaw';
+SELECT * FROM sales_list WHERE salesperson_name = 'Ivanov';
+
+RESET enable_seqscan;
``+SELECT * FROM sales_all WHERE sales_state = 'Warsaw';``
may ultimately fall back to using seqscan?
so we need to use
``explain(costs off)`` to see if it use indexscan or not.
+ /*
+ * We reject whole-row variables because the whole point of LIKE is
+ * that the new table's rowtype might later diverge from the parent's.
+ * So, while translation might be possible right now, it wouldn't be
+ * possible to guarantee it would work in future.
+ */
+ if (found_whole_row)
+ ereport(ERROR,
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot convert whole-row table reference"),
+ errdetail("Constraint \"%s\" contains a whole-row reference to table \"%s\".",
+ ccname,
+ RelationGetRelationName(parent_rel)));
this error is unlikely to happen, we can simply use elog(ERROR, ....),
rather than ereport.
evaluateGeneratedExpressionsAndCheckConstraints seem not necessary?
we should make the MergePartitionsMoveRows code pattern aligned with
ATRewriteTable.
by comparing these two function, i found that before call table_scan_getnextslot
we need to switch memory context to EState->ecxt_per_tuple_memor
please check the attached changes.
Attachments:
[application/octet-stream] v52-0001-refactor-MergePartitionsMoveRows.no-cfbot (6.1K, ../CACJufxGh=L6YPr37Y4t+ZfReBeWdv8aiNEk7VoyhYyP7d6L-4w@mail.gmail.com/2-v52-0001-refactor-MergePartitionsMoveRows.no-cfbot)
download
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], [email protected]
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
In-Reply-To: <CACJufxGh=L6YPr37Y4t+ZfReBeWdv8aiNEk7VoyhYyP7d6L-4w@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