Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Dmitry Koval <d.koval@postgrespro.ru>
From: Dmitry Koval <d.koval@postgrespro.ru>
To: jian he <jian.universality@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-06-12T20:36:25Z
Lists: pgsql-hackers
Attachments
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