Re: BUG #15724: Can't create foreign table as partition
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pavan Deolasee <pavan.deolasee@gmail.com>
Cc: stepya@ukr.net, pgsql-bugs@lists.postgresql.org
Date: 2019-06-21T15:49:15Z
Lists: 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
Commits
-
Fix partitioned index creation with foreign partitions
- 9653ca2197e2 11.5 landed
- 55ed3defc966 12.0 landed
-
Doc: Update documentation on partitioning vs. foreign tables.
- 7338ed28e2ec 11.3 landed
- 3e6b0c472942 12.0 landed