Re: pgsql: Fix partitioned index creation with foreign partitions - Mailing list pgsql-committers

From Amit Langote
Subject Re: pgsql: Fix partitioned index creation with foreign partitions
Date
Msg-id CA+HiwqGV=k_Eh4jBiQw66ivvdG+EUkrEYeHTYL1SvDj_YOYV0g@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: Fix partitioned index creation with foreign partitions  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: pgsql: Fix partitioned index creation with foreign partitions  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-committers
On Thu, Jun 27, 2019 at 8:04 AM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
>
> On 2019-Jun-26, Alvaro Herrera wrote:
>
> > Fix partitioned index creation with foreign partitions
>
> Hmm, so this causes prion to fail, because -DFORCE_RELCACHE_RELEASE: it
> reports the immediate parent of the would-be-partition rather than the
> topmost ancestor.  I'm not sure I understand why, since relcache release
> shouldn't affect recursion order (maybe that's another bug).  I'll
> investigate more tomorrow.

I see this diff:

 ALTER TABLE lt1 ADD PRIMARY KEY (a);
-ERROR:  cannot create unique index on partitioned table "lt1_part1"
-DETAIL:  Table "lt1_part1" contains partitions that are foreign tables.
+ERROR:  cannot create unique index on partitioned table "ft_part_1_1"
+DETAIL:  Table "ft_part_1_1" contains partitions that are foreign tables.

The table name reported here is that of the foreign table leaf
partition, not of the immediate parent.  Also, what's expected is not
the topmost ancestor, but the immediate parent, which seems OK,
because that's the best that the code in question can manage.

Anyway, the problem seems to use-after-close of a Relation pointer,
which the attached patch fixes.

Thanks,
Amit

Attachment

pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Remove remaining traces of Rand_OpenSSL() from the tree
Next
From: Michael Paquier
Date:
Subject: Re: pgsql: Drop test user when done with it.