diff options
author | Alexander Korotkov <akorotkov@postgresql.org> | 2024-04-30 12:00:15 +0300 |
---|---|---|
committer | Alexander Korotkov <akorotkov@postgresql.org> | 2024-04-30 12:00:15 +0300 |
commit | fcf80c5d5f0f3787e70fca8fd029d2e08a923f91 (patch) | |
tree | 0461724903632322b18d43578b8994ba321d5810 /doc/src | |
parent | 842c9b27057e8ecea02b816e3ec6c208779b3d39 (diff) | |
download | postgresql-fcf80c5d5f0f3787e70fca8fd029d2e08a923f91.tar.gz postgresql-fcf80c5d5f0f3787e70fca8fd029d2e08a923f91.zip |
Make new partitions with parent's persistence during MERGE/SPLIT
The createPartitionTable() function is responsible for creating new partitions
for ALTER TABLE ... MERGE PARTITIONS, and ALTER TABLE ... SPLIT PARTITION
commands. It emulates the behaviour of CREATE TABLE ... (LIKE ...), where
new table persistence should be specified by the user. In the table
partitioning persistent of the partition and its parent must match. So, this
commit makes createPartitionTable() copy the persistence of the parent
partition.
Also, this commit makes createPartitionTable() recheck the persistence after
the new table creation. This is needed because persistence might be affected
by pg_temp in search_path.
This commit also changes the signature of createPartitionTable() making it
take the parent's Relation itself instead of the name of the parent relation,
and return the Relation of new partition. That doesn't lead to
complications, because both callers have the parent table open and need to
open the new partition.
Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/dbc8b96c-3cf0-d1ee-860d-0e491da20485%40gmail.com
Author: Dmitry Koval
Reviewed-by: Alexander Korotkov, Robert Haas, Justin Pryzby, Pavel Borisov
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/alter_table.sgml | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index fc2dfffe49f..a7fed8a6010 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -1158,6 +1158,9 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM SQL command <literal>CREATE TABLE <replaceable class="parameter">partition_nameN</replaceable> (LIKE <replaceable class="parameter">name</replaceable> INCLUDING ALL EXCLUDING INDEXES EXCLUDING IDENTITY)</literal>. The indexes and identity are created later, after moving the data into the new partitions. + If the parent table is persistent then new partitions are created + persistent. If the parent table is temporary then new partitions + are also created temporary. </para> <note> <para> @@ -1224,6 +1227,9 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM SQL command <literal>CREATE TABLE <replaceable class="parameter">partition_name</replaceable> (LIKE <replaceable class="parameter">name</replaceable> INCLUDING ALL EXCLUDING INDEXES EXCLUDING IDENTITY)</literal>. The indexes and identity are created later, after moving the data into the new partition. + If the parent table is persistent then the new partition is created + persistent. If the parent table is temporary then the new partition + is also created temporary. </para> <note> <para> |