mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user