diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:18:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:18:03 +0000 |
commit | b4b8efbd3826ac0af2d1c2e7c40fcf80a4bfba45 (patch) | |
tree | bec866278030c41c624a91037b1dd88f41c99d8e /contrib/pageinspect/hashfuncs.c | |
parent | Adding upstream version 15.5. (diff) | |
download | postgresql-15-b4b8efbd3826ac0af2d1c2e7c40fcf80a4bfba45.tar.xz postgresql-15-b4b8efbd3826ac0af2d1c2e7c40fcf80a4bfba45.zip |
Adding upstream version 15.6.upstream/15.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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", |