Re: pgsql: Add pg_partition_root to display top-most parent of a partition

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Add pg_partition_root to display top-most parent of a partition
Date: 2019-03-22 03:55:38
Message-ID: 20190322035538.GO20192@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Fri, Mar 22, 2019 at 12:26:12AM -0300, Alvaro Herrera wrote:
> I noticed days ago that if you call pg_partition_root on the topmost
> partitioned table, the server crashes :-)

It's when you think that the thing is actually done that another issue
pops up. The attached fixes the issue, I suggest to return the
top-most parent as result if the input is the top-most parent itself.
Returning NULL does not make sense as in this case the relation can be
part of a partition tree.
--
Michael

Attachment Content-Type Size
partition-root-fix.patch text/x-diff 3.7 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Langote 2019-03-22 04:09:23 Re: [Suspect SPAM] Re: pgsql: Add pg_partition_root to display top-most parent of a partition
Previous Message Alvaro Herrera 2019-03-22 03:26:12 Re: pgsql: Add pg_partition_root to display top-most parent of a partition