Re: BUG #15724: Can't create foreign table as partition

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Cc: stepya(at)ukr(dot)net, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15724: Can't create foreign table as partition
Date: 2019-06-21 15:49:15
Message-ID: 20190621154915.GA17031@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2019-Jun-21, Pavan Deolasee wrote:

> On Thu, Jun 20, 2019 at 6:07 AM Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
> wrote:
>
> > With this patch, an index creation will no longer fail in the presence
> > of a partition that is a foreign table, as long as the index is not a
> > constraint index (not unique, not primary key). Conversely,
> > creating/attaching a partition that is a foreign table does not fail if
> > the partitioned table only has non-constraint indexes.
>
> Like others suggested above, I also think that we should make this is a
> no-op on the foreign tables i.e. not fail even when there exists a UNIQUE
> or PRIMARY KEY on the parent table. We simply assume that the appropriate
> constraints will be defined on the foreign side and violations will be
> caught. This is same as CHECK constraints on the foreign partitions, that
> we assume the foreign server will enforce.

I don't oppose making such a change in pg13, but it seems too much of a
behavior change to be making even in pg12, let alone in the stable
branches.

Therefore, my proposal --in response to this bug report-- is to
backpatch the previously proposed patch, which allows indexes to be
created [on partitioned tables containing foreign tables as partitions],
as long as they are not UNIQUE/PKs.

If others want to explore the implications of UNIQUE/PK indexes on
partitioned tables with foreign partitions, I won't stand in their way,
though it doesn't seem material for this thread.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-06-21 16:12:00 Re: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
Previous Message Alvaro Herrera 2019-06-21 15:03:58 Re: BUG #15768: Removed rpms and now require /etc/redhat-release