Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
От | Dmitry Koval |
---|---|
Тема | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands |
Дата | |
Msg-id | 26fe1a14-89aa-415d-a1b1-176526e54d3b@postgrespro.ru обсуждение исходный текст |
Ответ на | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands (stephane tachoires <stephane.tachoires@gmail.com>) |
Список | pgsql-hackers |
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
В списке pgsql-hackers по дате отправления: