summaryrefslogtreecommitdiffstats
path: root/contrib/pageinspect/hashfuncs.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:18:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:18:09 +0000
commitebe124eacd7c3faa36ed358e7cc1d7c5b419e5f6 (patch)
tree48fe9c3270176faa25c7d9fb47326f689be82fe4 /contrib/pageinspect/hashfuncs.c
parentReleasing progress-linux version 15.5-0+deb12u1~progress6.99u1. (diff)
downloadpostgresql-15-ebe124eacd7c3faa36ed358e7cc1d7c5b419e5f6.tar.xz
postgresql-15-ebe124eacd7c3faa36ed358e7cc1d7c5b419e5f6.zip
Merging upstream version 15.6.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--contrib/pageinspect/hashfuncs.c6
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",