Re: Indexes on partitioned tables and foreign partitions

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Arseny Sher <a(dot)sher(at)postgrespro(dot)ru>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Indexes on partitioned tables and foreign partitions
Date: 2018-05-15 00:47:24
Message-ID: ed06bf4e-9bd2-1e87-da53-3571b2aa853c@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018/05/15 2:29, Alvaro Herrera wrote:
> 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.

Thank you.

> 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.

Agreed. Most of the stuff in utility.c is for command dispatch and there
is no reason for this partitioning-related bit to be sitting here. Moving
it will require perhaps non-trivial adjustment of indexcmds.c code, so
let's leave it for later as you say.

Thanks,
Amit

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2018-05-15 00:51:47 Re: Postgres 11 release notes
Previous Message Bruce Momjian 2018-05-15 00:46:42 Re: Postgres 11 release notes