pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: pgsql-committers@postgresql.org
Subject: pgsql: Add relkind checks to certain contrib modules
Date: Thu, 09 Mar 2017 21:34:41 +0000
Message-ID: <E1cm5hp-00037A-UQ@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Add relkind checks to certain contrib modules

The contrib extensions pageinspect, pg_visibility and pgstattuple only
work against regular relations which have storage.  They don't work
against foreign tables, partitioned (parent) tables, views, et al.

Add checks to the user-callable functions to return a useful error
message to the user if they mistakenly pass an invalid relation to a
function which doesn't accept that kind of relation.

In passing, improve some of the existing checks to use ereport() instead
of elog(), add a function to consolidate common checks where
appropriate, and add some regression tests.

Author: Amit Langote, with various changes by me
Reviewed by: Michael Paquier and Corey Huinker
Discussion: https://postgr.es/m/ab91fd9d-4751-ee77-c87b-4dd704c1e59c@lab.ntt.co.jp

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c08d82f38ebf763b79bd43ae34b7310ee47aaacd

Modified Files
--------------
contrib/pageinspect/expected/page.out            |   9 ++
contrib/pageinspect/rawpage.c                    |   5 +
contrib/pageinspect/sql/page.sql                 |   9 ++
contrib/pg_visibility/.gitignore                 |   4 +
contrib/pg_visibility/Makefile                   |   2 +
contrib/pg_visibility/expected/pg_visibility.out | 142 +++++++++++++++++++++++
contrib/pg_visibility/pg_visibility.c            |  58 ++++++---
contrib/pg_visibility/sql/pg_visibility.sql      |  83 +++++++++++++
contrib/pgstattuple/expected/pgstattuple.out     | 107 +++++++++++++++++
contrib/pgstattuple/pgstatindex.c                |  52 +++++++--
contrib/pgstattuple/pgstattuple.c                |   3 +
contrib/pgstattuple/sql/pgstattuple.sql          |  64 ++++++++++
12 files changed, 517 insertions(+), 21 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1cm5hp-00037A-UQ@gemulon.postgresql.org>
Permalink:  ../E1cm5hp-00037A-UQ@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cm5hp-00037A-UQ@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: sfrost@snowman.net
  Subject: Re: pgsql: Add relkind checks to certain contrib modules
  In-Reply-To: <E1cm5hp-00037A-UQ@gemulon.postgresql.org>
  References: <E1cm5hp-00037A-UQ@gemulon.postgresql.org>

* 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