Re: BUG #15587: Partitions with ALTER TABLE ADD CONSTRAINT

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15587: Partitions with ALTER TABLE ADD CONSTRAINT
Date: 2019-01-15 18:24:57
Message-ID: 201901151824.mxkelqcnfeq6@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2019-Jan-10, Jesper Pedersen wrote:

> On 1/10/19 12:11 PM, Alvaro Herrera wrote:
> > On 2019-Jan-10, PG Bug reporting form wrote:
> > > Removing ONLY from the ALTER command makes the index correct.
> >
> > I'm not clear what problem you're reporting. If you use ONLY, then the
> > command doesn't cascade to create the index on partitions, and the index
> > is marked invalid. If you add the constraint to each partition and
> > ALTER INDEX ATTACH PARTITION, the index on t1 should become valid when
> > every partition of the table has its index.
>
> However, when you use ADD CONSTRAINT FOREIGN KEY you can't use ONLY, so
> would it be a good idea to make ADD CONSTRAINT UNIQUE behave the same way,
> i.e. error out ?

I haven't investigated this angle. It seems more complex than just a
simple bugfix, right?

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2019-01-15 18:26:28 Re: BUG #15587: Partitions with ALTER TABLE ADD CONSTRAINT
Previous Message Lacey, Nathan 2019-01-15 16:44:06 Postgres 10, changing user by "set role {user};" doesn't use that users "default_transaction_isolation"