diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-06-26 18:38:51 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-06-26 18:38:51 -0400 |
commit | 55ed3defc966cf718fe1e8c0efe964580bb23351 (patch) | |
tree | ddc9c211ea304679726c72019f92494450779c04 /doc/src | |
parent | 65e6d42140c8d9918638b9f73528288ab980af82 (diff) | |
download | postgresql-55ed3defc966cf718fe1e8c0efe964580bb23351.tar.gz postgresql-55ed3defc966cf718fe1e8c0efe964580bb23351.zip |
Fix partitioned index creation with foreign partitions
When a partitioned tables contains foreign tables as partitions, it is
not possible to implement unique or primary key indexes -- but when
regular indexes are created, there is no reason to do anything other
than ignoring such partitions. We were raising errors upon encountering
the foreign partitions, which is unfriendly and doesn't protect against
any actual problems.
Relax this restriction so that index creation is allowed on partitioned
tables containing foreign partitions, becoming a no-op on them. (We may
later want to redefine this so that the FDW is told to create the
indexes on the foreign side.) This applies to CREATE INDEX, as well as
ALTER TABLE / ATTACH PARTITION and CREATE TABLE / PARTITION OF.
Backpatch to 11, where indexes on partitioned tables were introduced.
Discussion: https://postgr.es/m/15724-d5a58fa9472eef4f@postgresql.org
Author: Álvaro Herrera
Reviewed-by: Amit Langote
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/alter_table.sgml | 2 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_foreign_table.sgml | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index f5ad7659f72..90bf19564c6 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -845,7 +845,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM as if <command>ALTER INDEX ATTACH PARTITION</command> had been executed. Note that if the existing table is a foreign table, it is currently not allowed to attach the table as a partition of the target table if there - are indexes on the target table. (See also + are <literal>UNIQUE</literal> indexes on the target table. (See also <xref linkend="sql-createforeigntable"/>.) </para> diff --git a/doc/src/sgml/ref/create_foreign_table.sgml b/doc/src/sgml/ref/create_foreign_table.sgml index 25d2f09ed20..9d266f272a7 100644 --- a/doc/src/sgml/ref/create_foreign_table.sgml +++ b/doc/src/sgml/ref/create_foreign_table.sgml @@ -170,8 +170,8 @@ CHECK ( <replaceable class="parameter">expression</replaceable> ) [ NO INHERIT ] See the similar form of <xref linkend="sql-createtable"/> for more details. Note that it is currently not allowed to create the foreign table as a - partition of the parent table if there are indexes on the parent table. - (See also + partition of the parent table if there are <literal>UNIQUE</literal> + indexes on the parent table. (See also <link linkend="sql-altertable"><command>ALTER TABLE ATTACH PARTITION</command></link>.) </para> </listitem> |