public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dmitry Koval <[email protected]>
To: Junwang Zhao <[email protected]>
Cc: [email protected]
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: Wed, 11 Jun 2025 16:10:00 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAEG8a3Lpw-h+T+Pfqcchyc9mp0r5UcWT5+uZYsew=1ZSkg-H+w@mail.gmail.com>
References: <171085360143.2046436.7217841141682511557.pgcf@coridan.postgresql.org>
<[email protected]>
<CAPpHfdv2V2tsvVn5LYyrJkzmPA==vbdCEKiT8j9yaaiDTfaQtA@mail.gmail.com>
<[email protected]>
<CALDaNm3V5DQSbZGxhYH+3MMMm-YdgOg+RdJ-ni6D0TZx_=Xd7w@mail.gmail.com>
<[email protected]>
<CAPpHfduH83+CW1dBppFVjxauPFGC+-ux+Y7wB0koZJCs029SXA@mail.gmail.com>
<[email protected]>
<CACJufxEi_JVg+=_BSS0o+TYUE_Hq+jmga_yxxuKLSGbQiAnZDg@mail.gmail.com>
<[email protected]>
<CACJufxFGPLTDW55bgaBTH1uCf0=YUZUVKWFrTBvOZNYKc49MxA@mail.gmail.com>
<CACJufxHHnJm6Jb2YQpuRU1RX__tO=JJNJ5=EUMuzif_KNxGd9A@mail.gmail.com>
<CACJufxFkscyhak2cSr8t+EPfwv11yccfEZBBnPbX4tRc_mWkXQ@mail.gmail.com>
<[email protected]>
<CAEG8a3Lpw-h+T+Pfqcchyc9mp0r5UcWT5+uZYsew=1ZSkg-H+w@mail.gmail.com>
Hi, Junwang Zhao!
Thank you for note.
1.
>Would it be better to use RELATION_IS_OTHER_TEMP in this case?
>I noticed that while other parts of tablecmds.c don’t use the macro,
>all other files consistently use RELATION_IS_OTHER_TEMP.
Agreed, RELATION_IS_OTHER_TEMP is better. Changed.
The fix will be in the next patch.
2.
>+/*
>+* We intended to create the partition with the same persistence as the
>+* parent table, but we still need to recheck because that might be
>+* affected by the search_path. If the parent is permanent, so must be
>+* all of its partitions.
>+*/
>I have trouble understanding how this is possible, can you kindly
>give me some guidance on this logic?
Perhaps this is best explained with an example.
(see src/test/regress/sql/partition_merge.sql).
(a) Create permanent table "t":
SET search_path = partitions_merge_schema, pg_temp, public;
CREATE TABLE t (i int) PARTITION BY RANGE (i);
CREATE TABLE tp_0_1 PARTITION OF t FOR VALUES FROM (0) TO (1);
CREATE TABLE tp_1_2 PARTITION OF t FOR VALUES FROM (1) TO (2);
(b) Attempt to merge persistent partitions tp_0_1, tp_1_2 into
temporary partition tp_0_2:
SET search_path = pg_temp, partitions_merge_schema, public;
-- Can't merge persistent partitions into a temporary partition
ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
(c) "ALTER TABLE ... MERGE PARTITIONS ..." will return an error:
ERROR: cannot create a temporary relation as partition of permanent
relation "t"
--
With best regards,
Dmitry Koval
Postgres Professional: http://postgrespro.com
view thread (178+ 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: <[email protected]>
* 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