From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix partitioned index creation with foreign partitions
Date: Wed, 26 Jun 2019 22:39:43 +0000
Message-ID: <E1hgGZr-00036R-BH@gemulon.postgresql.org> (raw)
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
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/9653ca2197e241ebeae127086ce1cc8b201a477e
Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml | 2 +-
doc/src/sgml/ref/create_foreign_table.sgml | 4 +--
src/backend/commands/indexcmds.c | 20 +++++++++++
src/backend/commands/tablecmds.c | 45 ++++++++++++++++++++++++
src/backend/tcop/utility.c | 12 +++++--
src/test/regress/expected/foreign_data.out | 56 ++++++++++++++++++++++++++++--
src/test/regress/sql/foreign_data.sql | 42 +++++++++++++++++++++-
7 files changed, 172 insertions(+), 9 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: alvherre@alvh.no-ip.org
Subject: Re: pgsql: Fix partitioned index creation with foreign partitions
In-Reply-To: <E1hgGZr-00036R-BH@gemulon.postgresql.org>
References: <E1hgGZr-00036R-BH@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox