RE: unique indexes on partitioned tables - Mailing list pgsql-hackers

From Shinoda, Noriyoshi
Subject RE: unique indexes on partitioned tables
Date
Msg-id AT5PR8401MB0786420254C5E428F9FF6CEBEED20@AT5PR8401MB0786.NAMPRD84.PROD.OUTLOOK.COM
Whole thread Raw
In response to Re: unique indexes on partitioned tables  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Hi Álvaro,

Thank you for your developing the new patch.
I will continue testing.

-----Original Message-----
From: Alvaro Herrera [mailto:alvherre@2ndquadrant.com]
Sent: Tuesday, March 13, 2018 7:51 AM
To: Shinoda, Noriyoshi <noriyoshi.shinoda@hpe.com>
Cc: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Jaime Casanova
<jaime.casanova@2ndquadrant.com>;Jesper Pedersen <jesper.pedersen@redhat.com>; Pg Hackers
<pgsql-hackers@postgresql.org>
Subject: Re: unique indexes on partitioned tables

Shinoda, Noriyoshi wrote:

Hi,

> I tried this feature with the latest snapshot. When I executed the
> following SQL statement, multiple primary keys were created on the
> partition.
> Is this the intended behavior?

It turns out that the error check for duplicate PKs is only invoked if you tell this code that it's being invoked by
ALTERTABLE, and my original patch wasn't.  I changed it and now everything seems to behave as expected. 

I added a test case pretty much like yours, which now works correctly.
I also added another one where the bogus PK is two levels down rather than one.  This is because I had originally
developeda different fix -- which fixed the problem for your test case, until I realized that since this code is
recursive,we could cause trouble at a distance. 

Thanks for reporting the problem

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


pgsql-hackers by date:

Previous
From: "Shinoda, Noriyoshi"
Date:
Subject: RE: [HACKERS] Commitfest 2018-9 duplicate patch deletion request.
Next
From: Craig Ringer
Date:
Subject: Re: Google Summer of Code: Potential Applicant