Add relkind checks to certain contrib modules
Stephen Frost <sfrost@snowman.net>
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
Files
| Path | Change | +/− |
|---|---|---|
| contrib/pageinspect/expected/page.out | modified | +9 −0 |
| contrib/pageinspect/rawpage.c | modified | +5 −0 |
| contrib/pageinspect/sql/page.sql | modified | +9 −0 |
| contrib/pgstattuple/expected/pgstattuple.out | modified | +107 −0 |
| contrib/pgstattuple/pgstatindex.c | modified | +45 −7 |
| contrib/pgstattuple/pgstattuple.c | modified | +3 −0 |
| contrib/pgstattuple/sql/pgstattuple.sql | modified | +64 −0 |
| contrib/pg_visibility/expected/pg_visibility.out | added | +142 −0 |
| contrib/pg_visibility/.gitignore | added | +4 −0 |
| contrib/pg_visibility/Makefile | modified | +2 −0 |
| contrib/pg_visibility/pg_visibility.c | modified | +44 −14 |
| contrib/pg_visibility/sql/pg_visibility.sql | added | +83 −0 |
Discussion
- contrib modules and relkind check 24 messages · 2017-01-24 → 2017-03-10