diff options
Diffstat (limited to 'contrib/pageinspect/hashfuncs.c')
-rw-r--r-- | contrib/pageinspect/hashfuncs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/pageinspect/hashfuncs.c b/contrib/pageinspect/hashfuncs.c index 69af7b9..7c0f73f 100644 --- a/contrib/pageinspect/hashfuncs.c +++ b/contrib/pageinspect/hashfuncs.c @@ -12,6 +12,7 @@ #include "access/hash.h" #include "access/htup_details.h" +#include "access/relation.h" #include "catalog/pg_am.h" #include "catalog/pg_type.h" #include "funcapi.h" @@ -27,6 +28,7 @@ PG_FUNCTION_INFO_V1(hash_page_items); PG_FUNCTION_INFO_V1(hash_bitmap_info); PG_FUNCTION_INFO_V1(hash_metapage_info); +#define IS_INDEX(r) ((r)->rd_rel->relkind == RELKIND_INDEX) #define IS_HASH(r) ((r)->rd_rel->relam == HASH_AM_OID) /* ------------------------------------------------ @@ -417,9 +419,9 @@ hash_bitmap_info(PG_FUNCTION_ARGS) (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be superuser to use raw page functions"))); - indexRel = index_open(indexRelid, AccessShareLock); + indexRel = relation_open(indexRelid, AccessShareLock); - if (!IS_HASH(indexRel)) + if (!IS_INDEX(indexRel) || !IS_HASH(indexRel)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is not a %s index", |