From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru> |
Cc: | Alexander Korotkov <aekorotkov(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands |
Date: | 2025-08-21 02:53:27 |
Message-ID: | CACJufxGh=L6YPr37Y4t+ZfReBeWdv8aiNEk7VoyhYyP7d6L-4w@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Aug 20, 2025 at 5:22 PM jian he <jian(dot)universality(at)gmail(dot)com> 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.
Attachment | Content-Type | Size |
---|---|---|
v52-0001-refactor-MergePartitionsMoveRows.no-cfbot | application/octet-stream | 6.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2025-08-21 02:57:58 | Re: Sequence Access Methods, round two |
Previous Message | Erik Wienhold | 2025-08-21 02:26:32 | Re: Add GUC to enable libxml2's XML_PARSE_HUGE |