diff options
Diffstat (limited to 'contrib/pageinspect/gistfuncs.c')
-rw-r--r-- | contrib/pageinspect/gistfuncs.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/pageinspect/gistfuncs.c b/contrib/pageinspect/gistfuncs.c index b2bbf4f6cbc..9c29fbc7aa6 100644 --- a/contrib/pageinspect/gistfuncs.c +++ b/contrib/pageinspect/gistfuncs.c @@ -55,6 +55,9 @@ gist_page_opaque_info(PG_FUNCTION_ARGS) page = get_page_from_raw(raw_page); + if (PageIsNew(page)) + PG_RETURN_NULL(); + /* verify the special space has the expected size */ if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GISTPageOpaqueData))) ereport(ERROR, @@ -130,6 +133,9 @@ gist_page_items_bytea(PG_FUNCTION_ARGS) page = get_page_from_raw(raw_page); + if (PageIsNew(page)) + PG_RETURN_NULL(); + /* verify the special space has the expected size */ if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GISTPageOpaqueData))) ereport(ERROR, @@ -220,6 +226,12 @@ gist_page_items(PG_FUNCTION_ARGS) page = get_page_from_raw(raw_page); + if (PageIsNew(page)) + { + index_close(indexRel, AccessShareLock); + PG_RETURN_NULL(); + } + /* Avoid bogus PageGetMaxOffsetNumber() call with deleted pages */ if (GistPageIsDeleted(page)) elog(NOTICE, "page is deleted"); |