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

Etsuro Fujita <etsuro.fujita@gmail.com>

From: Etsuro Fujita <etsuro.fujita@gmail.com>
To: Stepan Yankevych <Stepan_Yankevych@epam.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, Tom Lane <tgl@sss.pgh.pa.us>, Amit Langote <amitlangote09@gmail.com>, Pavan Deolasee <pavan.deolasee@gmail.com>, "stepya@ukr.net" <stepya@ukr.net>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2019-09-25T07:43:46Z
Lists: pgsql-bugs
On Wed, Sep 25, 2019 at 4:16 PM Stepan Yankevych
<Stepan_Yankevych@epam.com> wrote:
> As far as I can see  the issue has been fixed with following resolution
> Ignore partitions that are foreign tables when creating indexes on partitioned tables (Álvaro Herrera)
> Previously an error was thrown on encountering a foreign-table partition, but that's unhelpful and doesn't protect against any actual problem.

That's right.

> But I still can't create Pk on partitioned table
>
> See details:
> SELECT version();
> PostgreSQL 11.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit
>
> ALTER TABLE fix_capture.fix_message_json ADD CONSTRAINT fix_message_json_pk PRIMARY KEY (fix_message_id,date_id);
> SQL Error [42809]: ERROR: cannot create unique index on partitioned table "fix_message_json"
>   Detail: Table "fix_message_json" contains partitions that are foreign tables.
>
> Have I missed something?

Unfortunately, that is still a restriction: it's allowed to create
regular indexes, but not unique or primary key indexes [1].

Best regards,
Etsuro Fujita

[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=55ed3defc966cf718fe1e8c0efe964580bb23351



Commits

  1. Fix partitioned index creation with foreign partitions

  2. Doc: Update documentation on partitioning vs. foreign tables.