diff options
author | Stephen Frost | 2017-03-09 21:34:25 +0000 |
---|---|---|
committer | Stephen Frost | 2017-03-09 21:34:25 +0000 |
commit | c08d82f38ebf763b79bd43ae34b7310ee47aaacd (patch) | |
tree | 47963b660339cf68e64c2f836b23c52d9a252be1 /contrib/pgstattuple/pgstattuple.c | |
parent | b54aad8e34bd6299093e965c50f4a23da96d7cc3 (diff) |
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
Diffstat (limited to 'contrib/pgstattuple/pgstattuple.c')
-rw-r--r-- | contrib/pgstattuple/pgstattuple.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/pgstattuple/pgstattuple.c b/contrib/pgstattuple/pgstattuple.c index 06a1992bb17..b2432f43edf 100644 --- a/contrib/pgstattuple/pgstattuple.c +++ b/contrib/pgstattuple/pgstattuple.c @@ -293,6 +293,9 @@ pgstat_relation(Relation rel, FunctionCallInfo fcinfo) case RELKIND_FOREIGN_TABLE: err = "foreign table"; break; + case RELKIND_PARTITIONED_TABLE: + err = "partitioned table"; + break; default: err = "unknown"; break; |