Re: Indexes on partitioned tables and foreign partitions - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Indexes on partitioned tables and foreign partitions
Date
Msg-id 20180514172910.wjuvrtcdhcc5y3u7@alvherre.pgsql
Whole thread Raw
In response to Re: Indexes on partitioned tables and foreign partitions  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: Indexes on partitioned tables and foreign partitions
List pgsql-hackers
On 2018-May-10, Amit Langote wrote:

> How about we error out even *before* calling DefineIndex for the 1st time?
>  I see that ProcessUtilitySlow() gets a list of all partitions when
> locking them for index creation before calling DefineIndex.  Maybe, just
> go through the list and error out if one of them is a partition that we
> don't support creating an index on?

The overwhelming consensus seems to be for this option, so I pushed your
patch after some small tweaks -- mostly to simplify unnecessarily
baroque code.  (I must have been thinking that recursion would happen
right in ProcessUtilitySlow.  That doesn't match my memories, but I
can't explain this code otherwise.)  I added a very small test too.

I think it'd be better to take this out of ProcessUtility also and into
DefineInde, for cleanliness sake; maybe add a 'recursing' flag to
DefineIndex.  Not for pg11, though.

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


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: SPI/backend equivalent of extended-query Describe(statement)?
Next
From: Chapman Flack
Date:
Subject: Re: SPI/backend equivalent of extended-query Describe(statement)?