Re: pg_partition_tree crashes for a non-defined relation

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Postgres hackers <pgsql-hackers@postgresql.org>, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Date: 2018-12-08T04:33:32Z
Lists: pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:
> On Fri, Dec 07, 2018 at 10:04:06AM +0900, Michael Paquier wrote:
>> I think that we should make the function return NULL if the relation
>> defined does not exist, as we usually do for system-facing functions.
>> It is also easier for the caller to know that the relation does not
>> exist instead of having a plpgsql try/catch wrapper or such.

> Are there any objections about fixing this issue?  I would rather fix it
> sonner than later.

Return NULL seems a reasonable behavior.

How about cases where the relation OID exists but it's the wrong
kind of relation?

			regards, tom lane


Commits

  1. Test partition functions with legacy inheritance children, too

  2. Consider only relations part of partition trees in partition functions

  3. Make pg_partition_tree return no rows on unsupported and undefined objects

  4. Tweak pg_partition_tree for undefined relations and unsupported relkinds