Re: BUG #15724: Can't create foreign table as partition - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #15724: Can't create foreign table as partition
Date
Msg-id 20190621154915.GA17031@alvherre.pgsql
Whole thread Raw
In response to Re: BUG #15724: Can't create foreign table as partition  (Pavan Deolasee <pavan.deolasee@gmail.com>)
Responses Re: BUG #15724: Can't create foreign table as partition
List pgsql-bugs
On 2019-Jun-21, Pavan Deolasee wrote:

> On Thu, Jun 20, 2019 at 6:07 AM Alvaro Herrera <alvherre@2ndquadrant.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



pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: BUG #15768: Removed rpms and now require /etc/redhat-release
Next
From: Tom Lane
Date:
Subject: Re: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist