]> granicus.if.org Git - postgresql/commit
Add relkind checks to certain contrib modules
authorStephen Frost <sfrost@snowman.net>
Thu, 9 Mar 2017 21:34:25 +0000 (16:34 -0500)
committerStephen Frost <sfrost@snowman.net>
Thu, 9 Mar 2017 21:34:25 +0000 (16:34 -0500)
commitc08d82f38ebf763b79bd43ae34b7310ee47aaacd
tree47963b660339cf68e64c2f836b23c52d9a252be1
parentb54aad8e34bd6299093e965c50f4a23da96d7cc3
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
12 files changed:
contrib/pageinspect/expected/page.out
contrib/pageinspect/rawpage.c
contrib/pageinspect/sql/page.sql
contrib/pg_visibility/.gitignore [new file with mode: 0644]
contrib/pg_visibility/Makefile
contrib/pg_visibility/expected/pg_visibility.out [new file with mode: 0644]
contrib/pg_visibility/pg_visibility.c
contrib/pg_visibility/sql/pg_visibility.sql [new file with mode: 0644]
contrib/pgstattuple/expected/pgstattuple.out
contrib/pgstattuple/pgstatindex.c
contrib/pgstattuple/pgstattuple.c
contrib/pgstattuple/sql/pgstattuple.sql