Re: Add SPLIT PARTITION/MERGE PARTITIONS commands - Mailing list pgsql-hackers

From Dmitry Koval
Subject Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date
Msg-id 9c1b75f1-5c40-4a86-9a61-a4b3f1d7ec60@postgrespro.ru
Whole thread Raw
In response to Re: Add SPLIT PARTITION/MERGE PARTITIONS commands  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
Hi, Jian He!

Thanks for the notes and patches (again).
I read a part of emails, I hope to read the rest emails tomorrow.


1.
 >The attached patch ensures that the newly merged partition is
 >evaluated against all of its check constraints and that all stored
 >generated columns are recomputed, i guess this would be more safe.
 >v43-0001-MERGE-PARTITIONS-constraint-revalidation.no-cfbot

I modified the patch to apply it to the SPLIT PARTITION command too.


2.
 >but BuildDescForRelation is based on getAttributesList,
 >in getAttributesList, assign pg_attribute.attidentity to def->identity
 >should be safe, IMHO.

You are right. Corrected.


3.
+<para>
+If merged partitions have different owners, an error will be generated
 >since they <para> are related, these two can be one <para>?

Changed.


4.
 >I feel like it's not fully accurate, the following is what I can come
 >up with:
 >+<para>
 >+ When partitions are merged, any individual objects belonging to

Changed.


5.
 > /*
 >  * Detaching the partition might involve TOAST table access, so ensure
 >  * we have a valid snapshot.
 >  */
 > PushActiveSnapshot(GetTransactionSnapshot());
 > /* Do the final part of detaching */
 > DetachPartitionFinalize(rel, partRel, concurrent, defaultPartOid);
 > PopActiveSnapshot();
 >do we need do the same to the following DetachPartitionFinalize:
 >...

Thanks. This needs to be done, especially after the recent commit [1].
Fixed.


Links.
------
[1] Ensure we have a snapshot when updating various system catalogs, 
https://github.com/postgres/postgres/commit/706054b11b959c865c0c7935c34d92370d7168d4

-- 
With best regards,
Dmitry Koval

Postgres Professional: http://postgrespro.com
Attachment

pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: pg_dump --with-* options
Next
From: Nathan Bossart
Date:
Subject: Re: pg_dump --with-* options