Re: \d+ fails on index on partition - Mailing list pgsql-hackers

From Tom Lane
Subject Re: \d+ fails on index on partition
Date
Msg-id 23037.1538081499@sss.pgh.pa.us
Whole thread Raw
In response to \d+ fails on index on partition  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-hackers
Justin Pryzby <pryzby@telsasoft.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


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: [PATCH] Improve geometric types
Next
From: Alvaro Herrera
Date:
Subject: Re: [PATCH] Improve geometric types