From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Postgres hackers <pgsql-hackers@postgresql.org>
Subject: Re: pg_partition_tree crashes for a non-defined relation
Date: Thu, 28 Feb 2019 23:50:16 -0500
Message-ID: <10305.1551415816@sss.pgh.pa.us> (raw)
In-Reply-To: <de05e459-0562-f113-e82f-2627bc736b1d@lab.ntt.co.jp>
References: <20190228014549.GD1617@paquier.xyz>
<20190228193203.GA26151@alvherre.pgsql>
<20190301002204.GA1348@paquier.xyz>
<de05e459-0562-f113-e82f-2627bc736b1d@lab.ntt.co.jp>
Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes:
> On 2019/03/01 9:22, Michael Paquier wrote:
>> What I am writing next sounds perhaps a bit fancy, but in my opinion a
>> normal table is itself a partition tree, made of one single member:
>> itself.
> That's what we discussed, but it seems that we ended up allowing regular
> standalone tables (possibly in inheritance trees) only because it
> *appeared* to work. Alvaro already pointed out what appears to be a bug
> in how we compute the value of level. Instead of trying to fix it, I
> agree we should just disallow tables that are not a partitioned
> table/index or a partition (relispartition).
FWIW, I don't agree with Michael's suggestion above. A plain table is
significantly different from a partitioned table with no children:
you can store rows in the former but not the latter, and you can add
partitions to the latter but not the former. So conflating the two
doesn't seem likely to lead to any good outcome.
But, having said that, we've learned that it's generally bad for
catalog-query functions to fail outright just because they're pointed
at the wrong kind of catalog object. So I think that what we want here
is for pg_partition_tree to return NULL or an empty set or some such
for a plain table, while its output for a childless partitioned table
should be visibly different from that. I'm not wedded to details
beyond that idea.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, Langote_Amit_f8@lab.ntt.co.jp, michael@paquier.xyz, alvherre@2ndquadrant.com, sfrost@snowman.net
Subject: Re: pg_partition_tree crashes for a non-defined relation
In-Reply-To: <10305.1551415816@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox