Re: pgsql: Allow UNIQUE indexes on partitioned tables

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Allow UNIQUE indexes on partitioned tables
Date: 2018-03-12 16:34:15
Message-ID: 20180312163415.6s3enkeetf5cbkot@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

David G. Johnston wrote:

> Something like:
>
> When establishing a unique constraint for a multi-level partition hierarchy
> all the "partition by" columns of the target partitioned table, as well as
> those of all its descendant partitioned tables, must be included in the
> constraint definition.

Yeah, that seems better to me. Pushed.

> If I understand the above then the following failing test would be a worthy
> addition to memorialize the behavior of ALTER TABLE ATTACH under this
> constraint.
>
> create table idxpart (a int primary key, b int) partition by range (a);
> create table idxpart1 (a int not null, b int, primary key (a, b)) partition
> by range (a, b);
> alter table idxpart attach partition idxpart1 for values from (1) to (1000);

Included this one too.

Thanks for reading!

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

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2018-03-12 22:44:53 pgsql: Avoid having two PKs in a partition
Previous Message Alvaro Herrera 2018-03-12 16:33:56 pgsql: doc: Reword restriction on partition keys in unique indexes

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-03-12 16:43:20 Re: Cast jsonb to numeric, int, float, bool
Previous Message Narendra Pradeep U U 2018-03-12 16:32:52 Ambigous Plan - Larger Table on Hash Side