summaryrefslogtreecommitdiff
path: root/contrib/pgrowlocks
diff options
context:
space:
mode:
authorAndres Freund2019-04-01 21:57:21 +0000
committerAndres Freund2019-04-01 21:57:21 +0000
commit4b82664156c230b59607704506f5b0a32ef490a2 (patch)
treeaba59a8ddc7339e1c4139fa01e79e311fd01af61 /contrib/pgrowlocks
parentd45e40158623baacd3f36f92a670d435cc1e845f (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/pgrowlocks')
-rw-r--r--contrib/pgrowlocks/pgrowlocks.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/pgrowlocks/pgrowlocks.c b/contrib/pgrowlocks/pgrowlocks.c
index 61b753f8565..a2c44a916cf 100644
--- a/contrib/pgrowlocks/pgrowlocks.c
+++ b/contrib/pgrowlocks/pgrowlocks.c
@@ -30,6 +30,7 @@
#include "access/tableam.h"
#include "access/xact.h"
#include "catalog/namespace.h"
+#include "catalog/pg_am_d.h"
#include "catalog/pg_authid.h"
#include "funcapi.h"
#include "miscadmin.h"
@@ -101,6 +102,10 @@ pgrowlocks(PG_FUNCTION_ARGS)
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
rel = relation_openrv(relrv, AccessShareLock);
+ if (rel->rd_rel->relam != HEAP_TABLE_AM_OID)
+ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("only heap AM is supported")));
+
if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),