pg_partition_tree crashes for a non-defined relation

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Subject: pg_partition_tree crashes for a non-defined relation
Date: 2018-12-07 01:04:06
Message-ID: 20181207010406.GO2407@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

While testing another patch, I have bumped into the issue of
$subject... I should have put some more negative testing from the start
on this stuff, here is a culprit query when passing directly an OID:
select pg_partition_tree(0);

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.

Thoughts?
--
Michael

Attachment Content-Type Size
partition-tree-invalid.patch text/x-diff 1.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-12-07 01:40:15 Add pg_partition_root to get top-most parent of a partition tree
Previous Message Imai, Yoshikazu 2018-12-07 00:57:10 RE: speeding up planning with partitions