pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-hackers@postgresql.org, Alvaro Herrera <alvherre@2ndquadrant.com>
Subject: Re: \d+ fails on index on partition
Date: Thu, 27 Sep 2018 16:51:39 -0400
Message-ID: <23037.1538081499@sss.pgh.pa.us> (raw)
In-Reply-To: <20180927200020.GJ776@telsasoft.com>
References: <20180927200020.GJ776@telsasoft.com>

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




view thread (2+ messages)

Message-ID: <23037.1538081499@sss.pgh.pa.us>
Permalink:  ../23037.1538081499@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23037.1538081499@sss.pgh.pa.us

 · 

reply

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, pryzby@telsasoft.com, alvherre@2ndquadrant.com
  Subject: Re: \d+ fails on index on partition
  In-Reply-To: <23037.1538081499@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