PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
btreefuncs.c File Reference
#include "postgres.h"
#include "access/nbtree.h"
#include "access/relation.h"
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "pageinspect.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/rel.h"
#include "utils/varlena.h"
Include dependency graph for btreefuncs.c:

Go to the source code of this file.

Data Structures

struct  BTPageStat
 
struct  ua_page_stats
 
struct  ua_page_items
 

Macros

#define IS_INDEX(r)   ((r)->rd_rel->relkind == RELKIND_INDEX)
 
#define IS_BTREE(r)   ((r)->rd_rel->relam == BTREE_AM_OID)
 
#define BT_METAP_COLS_V1_8   9
 

Typedefs

typedef struct BTPageStat BTPageStat
 
typedef struct ua_page_stats ua_page_stats
 
typedef struct ua_page_items ua_page_items
 

Functions

 PG_FUNCTION_INFO_V1 (bt_metap)
 
 PG_FUNCTION_INFO_V1 (bt_page_items_1_9)
 
 PG_FUNCTION_INFO_V1 (bt_page_items)
 
 PG_FUNCTION_INFO_V1 (bt_page_items_bytea)
 
 PG_FUNCTION_INFO_V1 (bt_page_stats_1_9)
 
 PG_FUNCTION_INFO_V1 (bt_page_stats)
 
 PG_FUNCTION_INFO_V1 (bt_multi_page_stats)
 
static void GetBTPageStatistics (BlockNumber blkno, Buffer buffer, BTPageStat *stat)
 
static void check_relation_block_range (Relation rel, int64 blkno)
 
static void bt_index_block_validate (Relation rel, int64 blkno)
 
static Datum bt_page_stats_internal (PG_FUNCTION_ARGS, enum pageinspect_version ext_version)
 
Datum bt_page_stats_1_9 (PG_FUNCTION_ARGS)
 
Datum bt_page_stats (PG_FUNCTION_ARGS)
 
Datum bt_multi_page_stats (PG_FUNCTION_ARGS)
 
static Datum bt_page_print_tuples (ua_page_items *uargs)
 
static Datum bt_page_items_internal (PG_FUNCTION_ARGS, enum pageinspect_version ext_version)
 
Datum bt_page_items_1_9 (PG_FUNCTION_ARGS)
 
Datum bt_page_items (PG_FUNCTION_ARGS)
 
Datum bt_page_items_bytea (PG_FUNCTION_ARGS)
 
Datum bt_metap (PG_FUNCTION_ARGS)
 

Macro Definition Documentation

◆ BT_METAP_COLS_V1_8

#define BT_METAP_COLS_V1_8   9

Definition at line 827 of file btreefuncs.c.

◆ IS_BTREE

#define IS_BTREE (   r)    ((r)->rd_rel->relam == BTREE_AM_OID)

Definition at line 52 of file btreefuncs.c.

◆ IS_INDEX

#define IS_INDEX (   r)    ((r)->rd_rel->relkind == RELKIND_INDEX)

Definition at line 51 of file btreefuncs.c.

Typedef Documentation

◆ BTPageStat

typedef struct BTPageStat BTPageStat

◆ ua_page_items

typedef struct ua_page_items ua_page_items

◆ ua_page_stats

typedef struct ua_page_stats ua_page_stats

Function Documentation

◆ bt_index_block_validate()

static void bt_index_block_validate ( Relation  rel,
int64  blkno 
)
static

Definition at line 225 of file btreefuncs.c.

226{
227 if (!IS_INDEX(rel) || !IS_BTREE(rel))
229 (errcode(ERRCODE_WRONG_OBJECT_TYPE),
230 errmsg("\"%s\" is not a %s index",
231 RelationGetRelationName(rel), "btree")));
232
233 /*
234 * Reject attempts to read non-local temporary relations; we would be
235 * likely to get wrong data since we have no visibility into the owning
236 * session's local buffers.
237 */
238 if (RELATION_IS_OTHER_TEMP(rel))
240 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
241 errmsg("cannot access temporary tables of other sessions")));
242
243 if (blkno == 0)
245 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
246 errmsg("block 0 is a meta page")));
247
248 check_relation_block_range(rel, blkno);
249}
#define IS_BTREE(r)
Definition: btreefuncs.c:52
static void check_relation_block_range(Relation rel, int64 blkno)
Definition: btreefuncs.c:203
#define IS_INDEX(r)
Definition: btreefuncs.c:51
int errcode(int sqlerrcode)
Definition: elog.c:854
int errmsg(const char *fmt,...)
Definition: elog.c:1071
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149
#define RelationGetRelationName(relation)
Definition: rel.h:550
#define RELATION_IS_OTHER_TEMP(relation)
Definition: rel.h:669

References check_relation_block_range(), ereport, errcode(), errmsg(), ERROR, IS_BTREE, IS_INDEX, RELATION_IS_OTHER_TEMP, and RelationGetRelationName.

Referenced by bt_multi_page_stats(), bt_page_items_internal(), and bt_page_stats_internal().

◆ bt_metap()

Datum bt_metap ( PG_FUNCTION_ARGS  )

Definition at line 838 of file btreefuncs.c.

839{
841 Datum result;
842 Relation rel;
843 RangeVar *relrv;
844 BTMetaPageData *metad;
845 TupleDesc tupleDesc;
846 int j;
847 char *values[9];
848 Buffer buffer;
849 Page page;
850 HeapTuple tuple;
851
852 if (!superuser())
854 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
855 errmsg("must be superuser to use pageinspect functions")));
856
858 rel = relation_openrv(relrv, AccessShareLock);
859
860 if (!IS_INDEX(rel) || !IS_BTREE(rel))
862 (errcode(ERRCODE_WRONG_OBJECT_TYPE),
863 errmsg("\"%s\" is not a %s index",
864 RelationGetRelationName(rel), "btree")));
865
866 /*
867 * Reject attempts to read non-local temporary relations; we would be
868 * likely to get wrong data since we have no visibility into the owning
869 * session's local buffers.
870 */
871 if (RELATION_IS_OTHER_TEMP(rel))
873 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
874 errmsg("cannot access temporary tables of other sessions")));
875
876 buffer = ReadBuffer(rel, 0);
878
879 page = BufferGetPage(buffer);
880 metad = BTPageGetMeta(page);
881
882 /* Build a tuple descriptor for our result type */
883 if (get_call_result_type(fcinfo, NULL, &tupleDesc) != TYPEFUNC_COMPOSITE)
884 elog(ERROR, "return type must be a row type");
885
886 /*
887 * We need a kluge here to detect API versions prior to 1.8. Earlier
888 * versions incorrectly used int4 for certain columns.
889 *
890 * There is no way to reliably avoid the problems created by the old
891 * function definition at this point, so insist that the user update the
892 * extension.
893 */
894 if (tupleDesc->natts < BT_METAP_COLS_V1_8)
896 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
897 errmsg("function has wrong number of declared columns"),
898 errhint("To resolve the problem, update the \"pageinspect\" extension to the latest version.")));
899
900 j = 0;
901 values[j++] = psprintf("%d", metad->btm_magic);
902 values[j++] = psprintf("%d", metad->btm_version);
903 values[j++] = psprintf(INT64_FORMAT, (int64) metad->btm_root);
907
908 /*
909 * Get values of extended metadata if available, use default values
910 * otherwise. Note that we rely on the assumption that btm_allequalimage
911 * is initialized to zero with indexes that were built on versions prior
912 * to Postgres 13 (just like _bt_metaversion()).
913 */
914 if (metad->btm_version >= BTREE_NOVAC_VERSION)
915 {
919 values[j++] = metad->btm_allequalimage ? "t" : "f";
920 }
921 else
922 {
923 values[j++] = "0";
924 values[j++] = "-1";
925 values[j++] = "f";
926 }
927
929 values);
930
931 result = HeapTupleGetDatum(tuple);
932
933 UnlockReleaseBuffer(buffer);
935
936 PG_RETURN_DATUM(result);
937}
static Datum values[MAXATTR]
Definition: bootstrap.c:151
#define BT_METAP_COLS_V1_8
Definition: btreefuncs.c:827
int Buffer
Definition: buf.h:23
void UnlockReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:5390
void LockBuffer(Buffer buffer, int mode)
Definition: bufmgr.c:5607
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
Definition: bufmgr.c:758
#define BUFFER_LOCK_SHARE
Definition: bufmgr.h:197
static Page BufferGetPage(Buffer buffer)
Definition: bufmgr.h:417
PageData * Page
Definition: bufpage.h:82
#define INT64_FORMAT
Definition: c.h:520
int64_t int64
Definition: c.h:499
int errhint(const char *fmt,...)
Definition: elog.c:1318
#define elog(elevel,...)
Definition: elog.h:225
HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
Definition: execTuples.c:2324
AttInMetadata * TupleDescGetAttInMetadata(TupleDesc tupdesc)
Definition: execTuples.c:2275
#define PG_GETARG_TEXT_PP(n)
Definition: fmgr.h:309
#define PG_RETURN_DATUM(x)
Definition: fmgr.h:353
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
Definition: funcapi.c:276
@ TYPEFUNC_COMPOSITE
Definition: funcapi.h:149
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
Definition: funcapi.h:230
int j
Definition: isn.c:78
#define AccessShareLock
Definition: lockdefs.h:36
RangeVar * makeRangeVarFromNameList(const List *names)
Definition: namespace.c:3554
#define BTPageGetMeta(p)
Definition: nbtree.h:122
#define BTREE_NOVAC_VERSION
Definition: nbtree.h:153
NameData relname
Definition: pg_class.h:38
uintptr_t Datum
Definition: postgres.h:69
char * psprintf(const char *fmt,...)
Definition: psprintf.c:43
void relation_close(Relation relation, LOCKMODE lockmode)
Definition: relation.c:205
Relation relation_openrv(const RangeVar *relation, LOCKMODE lockmode)
Definition: relation.c:137
uint32 btm_last_cleanup_num_delpages
Definition: nbtree.h:115
uint32 btm_level
Definition: nbtree.h:109
float8 btm_last_cleanup_num_heap_tuples
Definition: nbtree.h:117
BlockNumber btm_fastroot
Definition: nbtree.h:110
uint32 btm_version
Definition: nbtree.h:107
uint32 btm_magic
Definition: nbtree.h:106
BlockNumber btm_root
Definition: nbtree.h:108
bool btm_allequalimage
Definition: nbtree.h:119
uint32 btm_fastlevel
Definition: nbtree.h:111
Definition: c.h:658
bool superuser(void)
Definition: superuser.c:46
List * textToQualifiedNameList(text *textval)
Definition: varlena.c:3467

References AccessShareLock, BT_METAP_COLS_V1_8, BTMetaPageData::btm_allequalimage, BTMetaPageData::btm_fastlevel, BTMetaPageData::btm_fastroot, BTMetaPageData::btm_last_cleanup_num_delpages, BTMetaPageData::btm_last_cleanup_num_heap_tuples, BTMetaPageData::btm_level, BTMetaPageData::btm_magic, BTMetaPageData::btm_root, BTMetaPageData::btm_version, BTPageGetMeta, BTREE_NOVAC_VERSION, BUFFER_LOCK_SHARE, BufferGetPage(), BuildTupleFromCStrings(), elog, ereport, errcode(), errhint(), errmsg(), ERROR, get_call_result_type(), HeapTupleGetDatum(), INT64_FORMAT, IS_BTREE, IS_INDEX, j, LockBuffer(), makeRangeVarFromNameList(), TupleDescData::natts, PG_GETARG_TEXT_PP, PG_RETURN_DATUM, psprintf(), ReadBuffer(), relation_close(), RELATION_IS_OTHER_TEMP, relation_openrv(), RelationGetRelationName, relname, superuser(), textToQualifiedNameList(), TupleDescGetAttInMetadata(), TYPEFUNC_COMPOSITE, UnlockReleaseBuffer(), and values.

◆ bt_multi_page_stats()

Datum bt_multi_page_stats ( PG_FUNCTION_ARGS  )

Definition at line 343 of file btreefuncs.c.

344{
345 Relation rel;
346 ua_page_stats *uargs;
347 FuncCallContext *fctx;
348 MemoryContext mctx;
349
350 if (!superuser())
352 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
353 errmsg("must be superuser to use pageinspect functions")));
354
355 if (SRF_IS_FIRSTCALL())
356 {
358 int64 blkno = PG_GETARG_INT64(1);
359 int64 blk_count = PG_GETARG_INT64(2);
360 RangeVar *relrv;
361
362 fctx = SRF_FIRSTCALL_INIT();
363
365 rel = relation_openrv(relrv, AccessShareLock);
366
367 /* Check that rel is a valid btree index and 1st block number is OK */
368 bt_index_block_validate(rel, blkno);
369
370 /*
371 * Check if upper bound of the specified range is valid. If only one
372 * page is requested, skip as we've already validated the page. (Also,
373 * it's important to skip this if blk_count is negative.)
374 */
375 if (blk_count > 1)
376 check_relation_block_range(rel, blkno + blk_count - 1);
377
378 /* Save arguments for reuse */
380
381 uargs = palloc(sizeof(ua_page_stats));
382
383 uargs->relid = RelationGetRelid(rel);
384 uargs->blkno = blkno;
385 uargs->blk_count = blk_count;
386 uargs->allpages = (blk_count < 0);
387
388 fctx->user_fctx = uargs;
389
391
392 /*
393 * To avoid possibly leaking a relcache reference if the SRF isn't run
394 * to completion, we close and re-open the index rel each time
395 * through, using the index's OID for re-opens to ensure we get the
396 * same rel. Keep the AccessShareLock though, to ensure it doesn't go
397 * away underneath us.
398 */
400 }
401
402 fctx = SRF_PERCALL_SETUP();
403 uargs = fctx->user_fctx;
404
405 /* We should have lock already */
406 rel = relation_open(uargs->relid, NoLock);
407
408 /* In all-pages mode, recheck the index length each time */
409 if (uargs->allpages)
410 uargs->blk_count = RelationGetNumberOfBlocks(rel) - uargs->blkno;
411
412 if (uargs->blk_count > 0)
413 {
414 /* We need to fetch next block statistics */
415 Buffer buffer;
416 Datum result;
417 HeapTuple tuple;
418 int j;
419 char *values[11];
421 TupleDesc tupleDesc;
422
423 buffer = ReadBuffer(rel, uargs->blkno);
425
426 /* keep compiler quiet */
427 stat.btpo_prev = stat.btpo_next = InvalidBlockNumber;
428 stat.btpo_flags = stat.free_size = stat.avg_item_size = 0;
429
430 GetBTPageStatistics(uargs->blkno, buffer, &stat);
431
432 UnlockReleaseBuffer(buffer);
434
435 /* Build a tuple descriptor for our result type */
436 if (get_call_result_type(fcinfo, NULL, &tupleDesc) != TYPEFUNC_COMPOSITE)
437 elog(ERROR, "return type must be a row type");
438
439 j = 0;
440 values[j++] = psprintf("%u", stat.blkno);
441 values[j++] = psprintf("%c", stat.type);
442 values[j++] = psprintf("%u", stat.live_items);
443 values[j++] = psprintf("%u", stat.dead_items);
444 values[j++] = psprintf("%u", stat.avg_item_size);
445 values[j++] = psprintf("%u", stat.page_size);
446 values[j++] = psprintf("%u", stat.free_size);
447 values[j++] = psprintf("%u", stat.btpo_prev);
448 values[j++] = psprintf("%u", stat.btpo_next);
449 values[j++] = psprintf("%u", stat.btpo_level);
450 values[j++] = psprintf("%d", stat.btpo_flags);
451
452 /* Construct tuple to be returned */
454 values);
455
456 result = HeapTupleGetDatum(tuple);
457
458 /*
459 * Move to the next block number and decrement the number of blocks
460 * still to be fetched
461 */
462 uargs->blkno++;
463 uargs->blk_count--;
464
465 SRF_RETURN_NEXT(fctx, result);
466 }
467
468 /* Done, so finally we can release the index lock */
470 SRF_RETURN_DONE(fctx);
471}
#define InvalidBlockNumber
Definition: block.h:33
static void bt_index_block_validate(Relation rel, int64 blkno)
Definition: btreefuncs.c:225
static void GetBTPageStatistics(BlockNumber blkno, Buffer buffer, BTPageStat *stat)
Definition: btreefuncs.c:108
#define RelationGetNumberOfBlocks(reln)
Definition: bufmgr.h:283
#define PG_GETARG_INT64(n)
Definition: fmgr.h:283
#define SRF_IS_FIRSTCALL()
Definition: funcapi.h:304
#define SRF_PERCALL_SETUP()
Definition: funcapi.h:308
#define SRF_RETURN_NEXT(_funcctx, _result)
Definition: funcapi.h:310
#define SRF_FIRSTCALL_INIT()
Definition: funcapi.h:306
#define SRF_RETURN_DONE(_funcctx)
Definition: funcapi.h:328
#define NoLock
Definition: lockdefs.h:34
void * palloc(Size size)
Definition: mcxt.c:1943
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:124
#define RelationGetRelid(relation)
Definition: rel.h:516
Relation relation_open(Oid relationId, LOCKMODE lockmode)
Definition: relation.c:47
void * user_fctx
Definition: funcapi.h:82
MemoryContext multi_call_memory_ctx
Definition: funcapi.h:101
int64 blk_count
Definition: btreefuncs.c:84
#define stat
Definition: win32_port.h:274

References AccessShareLock, ua_page_stats::allpages, ua_page_stats::blk_count, ua_page_stats::blkno, bt_index_block_validate(), BUFFER_LOCK_SHARE, BuildTupleFromCStrings(), check_relation_block_range(), elog, ereport, errcode(), errmsg(), ERROR, get_call_result_type(), GetBTPageStatistics(), HeapTupleGetDatum(), InvalidBlockNumber, j, LockBuffer(), makeRangeVarFromNameList(), MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, NoLock, palloc(), PG_GETARG_INT64, PG_GETARG_TEXT_PP, psprintf(), ReadBuffer(), relation_close(), relation_open(), relation_openrv(), RelationGetNumberOfBlocks, RelationGetRelid, ua_page_stats::relid, relname, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, stat, superuser(), textToQualifiedNameList(), TupleDescGetAttInMetadata(), TYPEFUNC_COMPOSITE, UnlockReleaseBuffer(), FuncCallContext::user_fctx, and values.

◆ bt_page_items()

Datum bt_page_items ( PG_FUNCTION_ARGS  )

Definition at line 718 of file btreefuncs.c.

719{
721}
static Datum bt_page_items_internal(PG_FUNCTION_ARGS, enum pageinspect_version ext_version)
Definition: btreefuncs.c:623
@ PAGEINSPECT_V1_8
Definition: pageinspect.h:23

References bt_page_items_internal(), and PAGEINSPECT_V1_8.

◆ bt_page_items_1_9()

Datum bt_page_items_1_9 ( PG_FUNCTION_ARGS  )

Definition at line 711 of file btreefuncs.c.

712{
714}
@ PAGEINSPECT_V1_9
Definition: pageinspect.h:24

References bt_page_items_internal(), and PAGEINSPECT_V1_9.

◆ bt_page_items_bytea()

Datum bt_page_items_bytea ( PG_FUNCTION_ARGS  )

Definition at line 733 of file btreefuncs.c.

734{
735 bytea *raw_page = PG_GETARG_BYTEA_P(0);
736 Datum result;
737 FuncCallContext *fctx;
738 ua_page_items *uargs;
739
740 if (!superuser())
742 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
743 errmsg("must be superuser to use raw page functions")));
744
745 if (SRF_IS_FIRSTCALL())
746 {
747 BTPageOpaque opaque;
748 MemoryContext mctx;
749 TupleDesc tupleDesc;
750
751 fctx = SRF_FIRSTCALL_INIT();
753
754 uargs = palloc(sizeof(ua_page_items));
755
756 uargs->page = get_page_from_raw(raw_page);
757
758 if (PageIsNew(uargs->page))
759 {
762 }
763
764 uargs->offset = FirstOffsetNumber;
765
766 /* verify the special space has the expected size */
767 if (PageGetSpecialSize(uargs->page) != MAXALIGN(sizeof(BTPageOpaqueData)))
769 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
770 errmsg("input page is not a valid %s page", "btree"),
771 errdetail("Expected special size %d, got %d.",
772 (int) MAXALIGN(sizeof(BTPageOpaqueData)),
773 (int) PageGetSpecialSize(uargs->page))));
774
775 opaque = BTPageGetOpaque(uargs->page);
776
777 if (P_ISMETA(opaque))
779 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
780 errmsg("block is a meta page")));
781
782 if (P_ISLEAF(opaque) && opaque->btpo_level != 0)
784 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
785 errmsg("block is not a valid btree leaf page")));
786
787 if (P_ISDELETED(opaque))
788 elog(NOTICE, "page is deleted");
789
790 if (!P_ISDELETED(opaque))
791 fctx->max_calls = PageGetMaxOffsetNumber(uargs->page);
792 else
793 {
794 /* Don't interpret BTDeletedPageData as index tuples */
795 elog(NOTICE, "page from block is deleted");
796 fctx->max_calls = 0;
797 }
798 uargs->leafpage = P_ISLEAF(opaque);
799 uargs->rightmost = P_RIGHTMOST(opaque);
800
801 /* Build a tuple descriptor for our result type */
802 if (get_call_result_type(fcinfo, NULL, &tupleDesc) != TYPEFUNC_COMPOSITE)
803 elog(ERROR, "return type must be a row type");
804 tupleDesc = BlessTupleDesc(tupleDesc);
805
806 uargs->tupd = tupleDesc;
807
808 fctx->user_fctx = uargs;
809
811 }
812
813 fctx = SRF_PERCALL_SETUP();
814 uargs = fctx->user_fctx;
815
816 if (fctx->call_cntr < fctx->max_calls)
817 {
818 result = bt_page_print_tuples(uargs);
819 uargs->offset++;
820 SRF_RETURN_NEXT(fctx, result);
821 }
822
823 SRF_RETURN_DONE(fctx);
824}
static Datum bt_page_print_tuples(ua_page_items *uargs)
Definition: btreefuncs.c:480
static uint16 PageGetSpecialSize(const PageData *page)
Definition: bufpage.h:317
static bool PageIsNew(const PageData *page)
Definition: bufpage.h:234
static OffsetNumber PageGetMaxOffsetNumber(const PageData *page)
Definition: bufpage.h:372
#define MAXALIGN(LEN)
Definition: c.h:782
int errdetail(const char *fmt,...)
Definition: elog.c:1204
#define NOTICE
Definition: elog.h:35
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
Definition: execTuples.c:2260
#define PG_RETURN_NULL()
Definition: fmgr.h:345
#define PG_GETARG_BYTEA_P(n)
Definition: fmgr.h:335
#define P_ISLEAF(opaque)
Definition: nbtree.h:221
#define P_ISMETA(opaque)
Definition: nbtree.h:224
#define BTPageGetOpaque(page)
Definition: nbtree.h:74
#define P_ISDELETED(opaque)
Definition: nbtree.h:223
#define P_RIGHTMOST(opaque)
Definition: nbtree.h:220
#define FirstOffsetNumber
Definition: off.h:27
Page get_page_from_raw(bytea *raw_page)
Definition: rawpage.c:218
uint32 btpo_level
Definition: nbtree.h:67
uint64 max_calls
Definition: funcapi.h:74
uint64 call_cntr
Definition: funcapi.h:65
OffsetNumber offset
Definition: btreefuncs.c:94
TupleDesc tupd
Definition: btreefuncs.c:97
bool rightmost
Definition: btreefuncs.c:96

References BlessTupleDesc(), bt_page_print_tuples(), BTPageGetOpaque, BTPageOpaqueData::btpo_level, FuncCallContext::call_cntr, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, FirstOffsetNumber, get_call_result_type(), get_page_from_raw(), ua_page_items::leafpage, FuncCallContext::max_calls, MAXALIGN, MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, NOTICE, ua_page_items::offset, P_ISDELETED, P_ISLEAF, P_ISMETA, P_RIGHTMOST, ua_page_items::page, PageGetMaxOffsetNumber(), PageGetSpecialSize(), PageIsNew(), palloc(), PG_GETARG_BYTEA_P, PG_RETURN_NULL, ua_page_items::rightmost, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, superuser(), ua_page_items::tupd, TYPEFUNC_COMPOSITE, and FuncCallContext::user_fctx.

◆ bt_page_items_internal()

static Datum bt_page_items_internal ( PG_FUNCTION_ARGS  ,
enum pageinspect_version  ext_version 
)
static

Definition at line 623 of file btreefuncs.c.

624{
626 int64 blkno = (ext_version == PAGEINSPECT_V1_8 ? PG_GETARG_UINT32(1) : PG_GETARG_INT64(1));
627 Datum result;
628 FuncCallContext *fctx;
629 MemoryContext mctx;
630 ua_page_items *uargs;
631
632 if (!superuser())
634 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
635 errmsg("must be superuser to use pageinspect functions")));
636
637 if (SRF_IS_FIRSTCALL())
638 {
639 RangeVar *relrv;
640 Relation rel;
641 Buffer buffer;
642 BTPageOpaque opaque;
643 TupleDesc tupleDesc;
644
645 fctx = SRF_FIRSTCALL_INIT();
646
648 rel = relation_openrv(relrv, AccessShareLock);
649
650 bt_index_block_validate(rel, blkno);
651
652 buffer = ReadBuffer(rel, blkno);
654
655 /*
656 * We copy the page into local storage to avoid holding pin on the
657 * buffer longer than we must, and possibly failing to release it at
658 * all if the calling query doesn't fetch all rows.
659 */
661
662 uargs = palloc(sizeof(ua_page_items));
663
664 uargs->page = palloc(BLCKSZ);
665 memcpy(uargs->page, BufferGetPage(buffer), BLCKSZ);
666
667 UnlockReleaseBuffer(buffer);
669
670 uargs->offset = FirstOffsetNumber;
671
672 opaque = BTPageGetOpaque(uargs->page);
673
674 if (!P_ISDELETED(opaque))
675 fctx->max_calls = PageGetMaxOffsetNumber(uargs->page);
676 else
677 {
678 /* Don't interpret BTDeletedPageData as index tuples */
679 elog(NOTICE, "page from block " INT64_FORMAT " is deleted", blkno);
680 fctx->max_calls = 0;
681 }
682 uargs->leafpage = P_ISLEAF(opaque);
683 uargs->rightmost = P_RIGHTMOST(opaque);
684
685 /* Build a tuple descriptor for our result type */
686 if (get_call_result_type(fcinfo, NULL, &tupleDesc) != TYPEFUNC_COMPOSITE)
687 elog(ERROR, "return type must be a row type");
688 tupleDesc = BlessTupleDesc(tupleDesc);
689
690 uargs->tupd = tupleDesc;
691
692 fctx->user_fctx = uargs;
693
695 }
696
697 fctx = SRF_PERCALL_SETUP();
698 uargs = fctx->user_fctx;
699
700 if (fctx->call_cntr < fctx->max_calls)
701 {
702 result = bt_page_print_tuples(uargs);
703 uargs->offset++;
704 SRF_RETURN_NEXT(fctx, result);
705 }
706
707 SRF_RETURN_DONE(fctx);
708}
#define PG_GETARG_UINT32(n)
Definition: fmgr.h:270

References AccessShareLock, BlessTupleDesc(), bt_index_block_validate(), bt_page_print_tuples(), BTPageGetOpaque, BUFFER_LOCK_SHARE, BufferGetPage(), FuncCallContext::call_cntr, elog, ereport, errcode(), errmsg(), ERROR, FirstOffsetNumber, get_call_result_type(), INT64_FORMAT, ua_page_items::leafpage, LockBuffer(), makeRangeVarFromNameList(), FuncCallContext::max_calls, MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, NOTICE, ua_page_items::offset, P_ISDELETED, P_ISLEAF, P_RIGHTMOST, ua_page_items::page, PageGetMaxOffsetNumber(), PAGEINSPECT_V1_8, palloc(), PG_GETARG_INT64, PG_GETARG_TEXT_PP, PG_GETARG_UINT32, ReadBuffer(), relation_close(), relation_openrv(), relname, ua_page_items::rightmost, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, superuser(), textToQualifiedNameList(), ua_page_items::tupd, TYPEFUNC_COMPOSITE, UnlockReleaseBuffer(), and FuncCallContext::user_fctx.

Referenced by bt_page_items(), and bt_page_items_1_9().

◆ bt_page_print_tuples()

static Datum bt_page_print_tuples ( ua_page_items uargs)
static

Definition at line 480 of file btreefuncs.c.

481{
482 Page page = uargs->page;
483 OffsetNumber offset = uargs->offset;
484 bool leafpage = uargs->leafpage;
485 bool rightmost = uargs->rightmost;
486 bool ispivottuple;
487 Datum values[9];
488 bool nulls[9];
489 HeapTuple tuple;
490 ItemId id;
491 IndexTuple itup;
492 int j;
493 int off;
494 int dlen;
495 char *dump,
496 *datacstring;
497 char *ptr;
498 ItemPointer htid;
499
500 id = PageGetItemId(page, offset);
501
502 if (!ItemIdIsValid(id))
503 elog(ERROR, "invalid ItemId");
504
505 itup = (IndexTuple) PageGetItem(page, id);
506
507 j = 0;
508 memset(nulls, 0, sizeof(nulls));
509 values[j++] = DatumGetInt16(offset);
510 values[j++] = ItemPointerGetDatum(&itup->t_tid);
511 values[j++] = Int32GetDatum((int) IndexTupleSize(itup));
514
515 ptr = (char *) itup + IndexInfoFindDataOffset(itup->t_info);
516 dlen = IndexTupleSize(itup) - IndexInfoFindDataOffset(itup->t_info);
517
518 /*
519 * Make sure that "data" column does not include posting list or pivot
520 * tuple representation of heap TID(s).
521 *
522 * Note: BTreeTupleIsPivot() won't work reliably on !heapkeyspace indexes
523 * (those built before BTREE_VERSION 4), but we have no way of determining
524 * if this page came from a !heapkeyspace index. We may only have a bytea
525 * nbtree page image to go on, so in general there is no metapage that we
526 * can check.
527 *
528 * That's okay here because BTreeTupleIsPivot() can only return false for
529 * a !heapkeyspace pivot, never true for a !heapkeyspace non-pivot. Since
530 * heap TID isn't part of the keyspace in a !heapkeyspace index anyway,
531 * there cannot possibly be a pivot tuple heap TID representation that we
532 * fail to make an adjustment for. A !heapkeyspace index can have
533 * BTreeTupleIsPivot() return true (due to things like suffix truncation
534 * for INCLUDE indexes in Postgres v11), but when that happens
535 * BTreeTupleGetHeapTID() can be trusted to work reliably (i.e. return
536 * NULL).
537 *
538 * Note: BTreeTupleIsPosting() always works reliably, even with
539 * !heapkeyspace indexes.
540 */
541 if (BTreeTupleIsPosting(itup))
542 dlen -= IndexTupleSize(itup) - BTreeTupleGetPostingOffset(itup);
543 else if (BTreeTupleIsPivot(itup) && BTreeTupleGetHeapTID(itup) != NULL)
544 dlen -= MAXALIGN(sizeof(ItemPointerData));
545
546 if (dlen < 0 || dlen > INDEX_SIZE_MASK)
547 elog(ERROR, "invalid tuple length %d for tuple at offset number %u",
548 dlen, offset);
549 dump = palloc0(dlen * 3 + 1);
550 datacstring = dump;
551 for (off = 0; off < dlen; off++)
552 {
553 if (off > 0)
554 *dump++ = ' ';
555 sprintf(dump, "%02x", *(ptr + off) & 0xff);
556 dump += 2;
557 }
558 values[j++] = CStringGetTextDatum(datacstring);
559 pfree(datacstring);
560
561 /*
562 * We need to work around the BTreeTupleIsPivot() !heapkeyspace limitation
563 * again. Deduce whether or not tuple must be a pivot tuple based on
564 * whether or not the page is a leaf page, as well as the page offset
565 * number of the tuple.
566 */
567 ispivottuple = (!leafpage || (!rightmost && offset == P_HIKEY));
568
569 /* LP_DEAD bit can never be set for pivot tuples, so show a NULL there */
570 if (!ispivottuple)
572 else
573 {
574 Assert(!ItemIdIsDead(id));
575 nulls[j++] = true;
576 }
577
578 htid = BTreeTupleGetHeapTID(itup);
579 if (ispivottuple && !BTreeTupleIsPivot(itup))
580 {
581 /* Don't show bogus heap TID in !heapkeyspace pivot tuple */
582 htid = NULL;
583 }
584
585 if (htid)
586 values[j++] = ItemPointerGetDatum(htid);
587 else
588 nulls[j++] = true;
589
590 if (BTreeTupleIsPosting(itup))
591 {
592 /* Build an array of item pointers */
593 ItemPointer tids;
594 Datum *tids_datum;
595 int nposting;
596
597 tids = BTreeTupleGetPosting(itup);
598 nposting = BTreeTupleGetNPosting(itup);
599 tids_datum = (Datum *) palloc(nposting * sizeof(Datum));
600 for (int i = 0; i < nposting; i++)
601 tids_datum[i] = ItemPointerGetDatum(&tids[i]);
602 values[j++] = PointerGetDatum(construct_array_builtin(tids_datum, nposting, TIDOID));
603 pfree(tids_datum);
604 }
605 else
606 nulls[j++] = true;
607
608 /* Build and return the result tuple */
609 tuple = heap_form_tuple(uargs->tupd, values, nulls);
610
611 return HeapTupleGetDatum(tuple);
612}
ArrayType * construct_array_builtin(Datum *elems, int nelems, Oid elmtype)
Definition: arrayfuncs.c:3381
static Item PageGetItem(const PageData *page, const ItemIdData *itemId)
Definition: bufpage.h:354
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
Definition: bufpage.h:244
#define CStringGetTextDatum(s)
Definition: builtins.h:97
Assert(PointerIsAligned(start, uint64))
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
Definition: heaptuple.c:1117
int i
Definition: isn.c:77
#define ItemIdIsDead(itemId)
Definition: itemid.h:113
#define ItemIdIsValid(itemId)
Definition: itemid.h:86
static Datum ItemPointerGetDatum(const ItemPointerData *X)
Definition: itemptr.h:237
static bool IndexTupleHasVarwidths(const IndexTupleData *itup)
Definition: itup.h:83
IndexTupleData * IndexTuple
Definition: itup.h:53
static bool IndexTupleHasNulls(const IndexTupleData *itup)
Definition: itup.h:77
static Size IndexTupleSize(const IndexTupleData *itup)
Definition: itup.h:71
static Size IndexInfoFindDataOffset(unsigned short t_info)
Definition: itup.h:112
#define INDEX_SIZE_MASK
Definition: itup.h:65
void pfree(void *pointer)
Definition: mcxt.c:2150
void * palloc0(Size size)
Definition: mcxt.c:1973
static uint16 BTreeTupleGetNPosting(IndexTuple posting)
Definition: nbtree.h:519
static bool BTreeTupleIsPivot(IndexTuple itup)
Definition: nbtree.h:481
#define P_HIKEY
Definition: nbtree.h:368
static ItemPointer BTreeTupleGetPosting(IndexTuple posting)
Definition: nbtree.h:538
static uint32 BTreeTupleGetPostingOffset(IndexTuple posting)
Definition: nbtree.h:530
static bool BTreeTupleIsPosting(IndexTuple itup)
Definition: nbtree.h:493
static ItemPointer BTreeTupleGetHeapTID(IndexTuple itup)
Definition: nbtree.h:639
uint16 OffsetNumber
Definition: off.h:24
#define sprintf
Definition: port.h:241
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:327
static Datum BoolGetDatum(bool X)
Definition: postgres.h:107
static Datum Int32GetDatum(int32 X)
Definition: postgres.h:217
static int16 DatumGetInt16(Datum X)
Definition: postgres.h:167
ItemPointerData t_tid
Definition: itup.h:37
unsigned short t_info
Definition: itup.h:49

References Assert(), BoolGetDatum(), BTreeTupleGetHeapTID(), BTreeTupleGetNPosting(), BTreeTupleGetPosting(), BTreeTupleGetPostingOffset(), BTreeTupleIsPivot(), BTreeTupleIsPosting(), construct_array_builtin(), CStringGetTextDatum, DatumGetInt16(), elog, ERROR, heap_form_tuple(), HeapTupleGetDatum(), i, INDEX_SIZE_MASK, IndexInfoFindDataOffset(), IndexTupleHasNulls(), IndexTupleHasVarwidths(), IndexTupleSize(), Int32GetDatum(), ItemIdIsDead, ItemIdIsValid, ItemPointerGetDatum(), j, ua_page_items::leafpage, MAXALIGN, ua_page_items::offset, P_HIKEY, ua_page_items::page, PageGetItem(), PageGetItemId(), palloc(), palloc0(), pfree(), PointerGetDatum(), ua_page_items::rightmost, sprintf, IndexTupleData::t_info, IndexTupleData::t_tid, ua_page_items::tupd, and values.

Referenced by bt_page_items_bytea(), and bt_page_items_internal().

◆ bt_page_stats()

Datum bt_page_stats ( PG_FUNCTION_ARGS  )

Definition at line 328 of file btreefuncs.c.

329{
331}
static Datum bt_page_stats_internal(PG_FUNCTION_ARGS, enum pageinspect_version ext_version)
Definition: btreefuncs.c:259

References bt_page_stats_internal(), and PAGEINSPECT_V1_8.

◆ bt_page_stats_1_9()

Datum bt_page_stats_1_9 ( PG_FUNCTION_ARGS  )

Definition at line 321 of file btreefuncs.c.

322{
324}

References bt_page_stats_internal(), and PAGEINSPECT_V1_9.

◆ bt_page_stats_internal()

static Datum bt_page_stats_internal ( PG_FUNCTION_ARGS  ,
enum pageinspect_version  ext_version 
)
static

Definition at line 259 of file btreefuncs.c.

260{
262 int64 blkno = (ext_version == PAGEINSPECT_V1_8 ? PG_GETARG_UINT32(1) : PG_GETARG_INT64(1));
263 Buffer buffer;
264 Relation rel;
265 RangeVar *relrv;
266 Datum result;
267 HeapTuple tuple;
268 TupleDesc tupleDesc;
269 int j;
270 char *values[11];
272
273 if (!superuser())
275 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
276 errmsg("must be superuser to use pageinspect functions")));
277
279 rel = relation_openrv(relrv, AccessShareLock);
280
281 bt_index_block_validate(rel, blkno);
282
283 buffer = ReadBuffer(rel, blkno);
285
286 /* keep compiler quiet */
287 stat.btpo_prev = stat.btpo_next = InvalidBlockNumber;
288 stat.btpo_flags = stat.free_size = stat.avg_item_size = 0;
289
290 GetBTPageStatistics(blkno, buffer, &stat);
291
292 UnlockReleaseBuffer(buffer);
294
295 /* Build a tuple descriptor for our result type */
296 if (get_call_result_type(fcinfo, NULL, &tupleDesc) != TYPEFUNC_COMPOSITE)
297 elog(ERROR, "return type must be a row type");
298
299 j = 0;
300 values[j++] = psprintf("%u", stat.blkno);
301 values[j++] = psprintf("%c", stat.type);
302 values[j++] = psprintf("%u", stat.live_items);
303 values[j++] = psprintf("%u", stat.dead_items);
304 values[j++] = psprintf("%u", stat.avg_item_size);
305 values[j++] = psprintf("%u", stat.page_size);
306 values[j++] = psprintf("%u", stat.free_size);
307 values[j++] = psprintf("%u", stat.btpo_prev);
308 values[j++] = psprintf("%u", stat.btpo_next);
309 values[j++] = psprintf("%u", stat.btpo_level);
310 values[j++] = psprintf("%d", stat.btpo_flags);
311
313 values);
314
315 result = HeapTupleGetDatum(tuple);
316
317 PG_RETURN_DATUM(result);
318}

References AccessShareLock, bt_index_block_validate(), BUFFER_LOCK_SHARE, BuildTupleFromCStrings(), elog, ereport, errcode(), errmsg(), ERROR, get_call_result_type(), GetBTPageStatistics(), HeapTupleGetDatum(), InvalidBlockNumber, j, LockBuffer(), makeRangeVarFromNameList(), PAGEINSPECT_V1_8, PG_GETARG_INT64, PG_GETARG_TEXT_PP, PG_GETARG_UINT32, PG_RETURN_DATUM, psprintf(), ReadBuffer(), relation_close(), relation_openrv(), relname, stat, superuser(), textToQualifiedNameList(), TupleDescGetAttInMetadata(), TYPEFUNC_COMPOSITE, UnlockReleaseBuffer(), and values.

Referenced by bt_page_stats(), and bt_page_stats_1_9().

◆ check_relation_block_range()

static void check_relation_block_range ( Relation  rel,
int64  blkno 
)
static

Definition at line 203 of file btreefuncs.c.

204{
205 /* Ensure we can cast to BlockNumber */
206 if (blkno < 0 || blkno > MaxBlockNumber)
208 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
209 errmsg("invalid block number %" PRId64, blkno)));
210
211 if ((BlockNumber) (blkno) >= RelationGetNumberOfBlocks(rel))
213 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
214 errmsg("block number %" PRId64 " is out of range", blkno)));
215}
uint32 BlockNumber
Definition: block.h:31
#define MaxBlockNumber
Definition: block.h:35

References ereport, errcode(), errmsg(), ERROR, MaxBlockNumber, and RelationGetNumberOfBlocks.

Referenced by bt_index_block_validate(), and bt_multi_page_stats().

◆ GetBTPageStatistics()

static void GetBTPageStatistics ( BlockNumber  blkno,
Buffer  buffer,
BTPageStat stat 
)
static

Definition at line 108 of file btreefuncs.c.

109{
110 Page page = BufferGetPage(buffer);
111 PageHeader phdr = (PageHeader) page;
113 BTPageOpaque opaque = BTPageGetOpaque(page);
114 int item_size = 0;
115 int off;
116
117 stat->blkno = blkno;
118
119 stat->max_avail = BLCKSZ - (BLCKSZ - phdr->pd_special + SizeOfPageHeaderData);
120
121 stat->dead_items = stat->live_items = 0;
122
123 stat->page_size = PageGetPageSize(page);
124
125 /* page type (flags) */
126 if (P_ISDELETED(opaque))
127 {
128 /* We divide deleted pages into leaf ('d') or internal ('D') */
129 if (P_ISLEAF(opaque) || !P_HAS_FULLXID(opaque))
130 stat->type = 'd';
131 else
132 stat->type = 'D';
133
134 /*
135 * Report safexid in a deleted page.
136 *
137 * Handle pg_upgrade'd deleted pages that used the previous safexid
138 * representation in btpo_level field (this used to be a union type
139 * called "bpto").
140 */
141 if (P_HAS_FULLXID(opaque))
142 {
144
145 elog(DEBUG2, "deleted page from block %u has safexid %u:%u",
146 blkno, EpochFromFullTransactionId(safexid),
147 XidFromFullTransactionId(safexid));
148 }
149 else
150 elog(DEBUG2, "deleted page from block %u has safexid %u",
151 blkno, opaque->btpo_level);
152
153 /* Don't interpret BTDeletedPageData as index tuples */
154 maxoff = InvalidOffsetNumber;
155 }
156 else if (P_IGNORE(opaque))
157 stat->type = 'e';
158 else if (P_ISLEAF(opaque))
159 stat->type = 'l';
160 else if (P_ISROOT(opaque))
161 stat->type = 'r';
162 else
163 stat->type = 'i';
164
165 /* btpage opaque data */
166 stat->btpo_prev = opaque->btpo_prev;
167 stat->btpo_next = opaque->btpo_next;
168 stat->btpo_level = opaque->btpo_level;
169 stat->btpo_flags = opaque->btpo_flags;
170 stat->btpo_cycleid = opaque->btpo_cycleid;
171
172 /* count live and dead tuples, and free space */
173 for (off = FirstOffsetNumber; off <= maxoff; off++)
174 {
175 IndexTuple itup;
176
177 ItemId id = PageGetItemId(page, off);
178
179 itup = (IndexTuple) PageGetItem(page, id);
180
181 item_size += IndexTupleSize(itup);
182
183 if (!ItemIdIsDead(id))
184 stat->live_items++;
185 else
186 stat->dead_items++;
187 }
188 stat->free_size = PageGetFreeSpace(page);
189
190 if ((stat->live_items + stat->dead_items) > 0)
191 stat->avg_item_size = item_size / (stat->live_items + stat->dead_items);
192 else
193 stat->avg_item_size = 0;
194}
Size PageGetFreeSpace(const PageData *page)
Definition: bufpage.c:906
PageHeaderData * PageHeader
Definition: bufpage.h:174
static Size PageGetPageSize(const PageData *page)
Definition: bufpage.h:277
#define SizeOfPageHeaderData
Definition: bufpage.h:217
#define DEBUG2
Definition: elog.h:29
#define P_HAS_FULLXID(opaque)
Definition: nbtree.h:229
static FullTransactionId BTPageGetDeleteXid(Page page)
Definition: nbtree.h:261
#define P_ISROOT(opaque)
Definition: nbtree.h:222
#define P_IGNORE(opaque)
Definition: nbtree.h:226
#define InvalidOffsetNumber
Definition: off.h:26
BlockNumber btpo_next
Definition: nbtree.h:66
BlockNumber btpo_prev
Definition: nbtree.h:65
uint16 btpo_flags
Definition: nbtree.h:68
BTCycleId btpo_cycleid
Definition: nbtree.h:69
LocationIndex pd_special
Definition: bufpage.h:168
#define EpochFromFullTransactionId(x)
Definition: transam.h:47
#define XidFromFullTransactionId(x)
Definition: transam.h:48

References BTPageGetDeleteXid(), BTPageGetOpaque, BTPageOpaqueData::btpo_cycleid, BTPageOpaqueData::btpo_flags, BTPageOpaqueData::btpo_level, BTPageOpaqueData::btpo_next, BTPageOpaqueData::btpo_prev, BufferGetPage(), DEBUG2, elog, EpochFromFullTransactionId, FirstOffsetNumber, IndexTupleSize(), InvalidOffsetNumber, ItemIdIsDead, P_HAS_FULLXID, P_IGNORE, P_ISDELETED, P_ISLEAF, P_ISROOT, PageGetFreeSpace(), PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageGetPageSize(), PageHeaderData::pd_special, SizeOfPageHeaderData, and XidFromFullTransactionId.

Referenced by bt_multi_page_stats(), and bt_page_stats_internal().

◆ PG_FUNCTION_INFO_V1() [1/7]

PG_FUNCTION_INFO_V1 ( bt_metap  )

◆ PG_FUNCTION_INFO_V1() [2/7]

PG_FUNCTION_INFO_V1 ( bt_multi_page_stats  )

◆ PG_FUNCTION_INFO_V1() [3/7]

PG_FUNCTION_INFO_V1 ( bt_page_items  )

◆ PG_FUNCTION_INFO_V1() [4/7]

PG_FUNCTION_INFO_V1 ( bt_page_items_1_9  )

◆ PG_FUNCTION_INFO_V1() [5/7]

PG_FUNCTION_INFO_V1 ( bt_page_items_bytea  )

◆ PG_FUNCTION_INFO_V1() [6/7]

PG_FUNCTION_INFO_V1 ( bt_page_stats  )

◆ PG_FUNCTION_INFO_V1() [7/7]

PG_FUNCTION_INFO_V1 ( bt_page_stats_1_9  )