Re: \d+ fails on index on partition

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Subject: Re: \d+ fails on index on partition
Date: 2018-09-27 20:51:39
Message-ID: 23037.1538081499@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Justin Pryzby <pryzby(at)telsasoft(dot)com> writes:
> pg_get_partition_constraintdef() doesn't like being passed a relkind='I',

It'll also fall over if the passed OID isn't a relation at all, which
is also very much not-nice for SQL-exposed inquiry functions.

I'm inclined to fix this by

(1) inventing an lsyscache function to fetch relispartition, which
will have the behavior of returning false for a lookup failure
(which is generally consistent with the behavior of most of the
other lsyscache functions).

(2) replace the if (rel->rd_rel->relispartition) check in
get_partition_qual_relid with a test like if (get_rel_relispartition(relid)),
and don't open the Relation at all unless that succeeds.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-09-27 20:59:17 Re: [PATCH] Improve geometric types
Previous Message Tomas Vondra 2018-09-27 20:42:14 Re: [PATCH] Improve geometric types