Re: create partitioned table with (like table INCLUDING ALL ) fails with "insufficient columns in UNIQUE constraint definition"

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Stuart <sfbarbee(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: create partitioned table with (like table INCLUDING ALL ) fails with "insufficient columns in UNIQUE constraint definition"
Date: 2018-12-14 00:42:09
Message-ID: f97f9840-1e30-32be-632d-934388436878@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2018/12/14 8:35, Stuart wrote:
> Amit,
>
> Thanks for your response. So partitioning does not recognize a primary key
> constraint on the partition key as a unique constraint? Shouldn't it?

It does. When you dropped all UNIQUE constraints on the source table that
didn't contain object_id in it except PRIMARY KEY (object_id), then it did
indeed work, as seen in your first email:

> =# drop index knowledge_categoryfilepathurl_un ;
> DROP INDEX
>
> =# \d+ knowledge

[ ... ]

> Indexes:
> "knowledge_pk" PRIMARY KEY, btree (object_id), tablespace "pgindex"
> Inherits: products
>
> =# create table knowledge_new (like knowledge INCLUDING ALL ) PARTITION
> BY RANGE ( object_id ) ;
> CREATE TABLE

Thanks,
Amit

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Langote 2018-12-14 02:19:16 Re: Errors creating partitioned tables from existing using (LIKE <table>) after renaming table constraints
Previous Message Michael Paquier 2018-12-14 00:20:38 Re: Errors creating partitioned tables from existing using (LIKE <table>) after renaming table constraints