From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix partitioned index creation with foreign partitions |
Date: | 2019-06-26 22:39:43 |
Message-ID: | E1hgGZr-00036Q-B9@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/55ed3defc966cf718fe1e8c0efe964580bb23351
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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2019-06-26 22:48:16 | Re: UCT (Re: pgsql: Update time zone data files to tzdata release 2019a.) |
Previous Message | Stephen Frost | 2019-06-26 19:07:33 | Re: pgsql: Drop test user when done with it. |