diff options
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 d36758af9a6..ed62aef7669 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); |