diff options
author | Andres Freund | 2019-04-01 21:57:21 +0000 |
---|---|---|
committer | Andres Freund | 2019-04-01 21:57:21 +0000 |
commit | 4b82664156c230b59607704506f5b0a32ef490a2 (patch) | |
tree | aba59a8ddc7339e1c4139fa01e79e311fd01af61 /contrib/pgstattuple/pgstatapprox.c | |
parent | d45e40158623baacd3f36f92a670d435cc1e845f (diff) |
Only allow heap in a number of contrib modules.
Contrib modules pgrowlocks, pgstattuple and some functionality in
pageinspect currently only supports the heap table AM. As they are all
concerned with low-level details that aren't reasonably exposed via
tableam, error out if invoked on a non heap relation.
Author: Andres Freund
Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
Diffstat (limited to 'contrib/pgstattuple/pgstatapprox.c')
-rw-r--r-- | contrib/pgstattuple/pgstatapprox.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/pgstattuple/pgstatapprox.c b/contrib/pgstattuple/pgstatapprox.c index d36758af9a..ed62aef766 100644 --- a/contrib/pgstattuple/pgstatapprox.c +++ b/contrib/pgstattuple/pgstatapprox.c @@ -20,6 +20,8 @@ #include "access/multixact.h" #include "access/htup_details.h" #include "catalog/namespace.h" +#include "catalog/pg_am_d.h" +#include "commands/vacuum.h" #include "funcapi.h" #include "miscadmin.h" #include "storage/bufmgr.h" @@ -27,7 +29,6 @@ #include "storage/procarray.h" #include "storage/lmgr.h" #include "utils/builtins.h" -#include "commands/vacuum.h" PG_FUNCTION_INFO_V1(pgstattuple_approx); PG_FUNCTION_INFO_V1(pgstattuple_approx_v1_5); @@ -291,6 +292,10 @@ pgstattuple_approx_internal(Oid relid, FunctionCallInfo fcinfo) errmsg("\"%s\" is not a table or materialized view", RelationGetRelationName(rel)))); + if (rel->rd_rel->relam != HEAP_TABLE_AM_OID) + ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("only heap AM is supported"))); + statapprox_heap(rel, &stat); relation_close(rel, AccessShareLock); |