16#include "catalog/pg_am_d.h"
31#define IS_BRIN(r) ((r)->rd_rel->relam == BRIN_AM_OID)
53 errmsg(
"must be superuser to use raw page functions")));
64 errmsg(
"input page is not a valid %s page",
"BRIN"),
65 errdetail(
"Expected special size %d, got %d.",
104 errmsg(
"input page is not a valid %s page",
"BRIN"),
105 errdetail(
"Expected special size %d, got %d.",
114 errdetail(
"Expected special type %08x, got %08x.",
121#define BRIN_PAGE_ITEMS_V1_12 8
146 errmsg(
"must be superuser to use raw page functions")));
162 errmsg(
"function has wrong number of declared columns"),
163 errhint(
"To resolve the problem, update the \"pageinspect\" extension to the latest version.")));
170 errmsg(
"\"%s\" is not a %s index",
190 for (attno = 1; attno <=
bdesc->bd_tupdesc->natts; attno++)
209 columns[attno - 1] =
column;
279 if (!
dtup->bt_columns[
att].bv_allnulls)
322 else if (attno >=
bdesc->bd_tupdesc->natts)
356 errmsg(
"must be superuser to use raw page functions")));
365 elog(
ERROR,
"return type must be a row type");
396 errmsg(
"must be superuser to use raw page functions")));
Datum idx(PG_FUNCTION_ARGS)
static Datum values[MAXATTR]
void brin_free_desc(BrinDesc *bdesc)
BrinDesc * brin_build_desc(Relation rel)
#define BRIN_PAGETYPE_REVMAP
#define BRIN_PAGETYPE_REGULAR
#define BRIN_PAGETYPE_META
#define BrinPageType(page)
#define REVMAP_PAGE_MAXITEMS
BrinMemTuple * brin_deform_tuple(BrinDesc *brdesc, BrinTuple *tuple, BrinMemTuple *dMemtuple)
Datum brin_revmap_data(PG_FUNCTION_ARGS)
Datum brin_metapage_info(PG_FUNCTION_ARGS)
#define BRIN_PAGE_ITEMS_V1_12
Datum brin_page_type(PG_FUNCTION_ARGS)
static Page verify_brin_page(bytea *raw_page, uint16 type, const char *strtype)
Datum brin_page_items(PG_FUNCTION_ARGS)
static uint16 PageGetSpecialSize(const PageData *page)
static bool PageIsNew(const PageData *page)
static char * PageGetContents(Page page)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static void * PageGetItem(PageData *page, const ItemIdData *itemId)
static OffsetNumber PageGetMaxOffsetNumber(const PageData *page)
#define CStringGetTextDatum(s)
#define FLEXIBLE_ARRAY_MEMBER
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
#define palloc_array(type, count)
void fmgr_info(Oid functionId, FmgrInfo *finfo)
char * OutputFunctionCall(FmgrInfo *flinfo, Datum val)
#define PG_FUNCTION_INFO_V1(funcname)
#define PG_RETURN_TEXT_P(x)
#define PG_RETURN_DATUM(x)
#define PG_GETARG_BYTEA_P(n)
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
#define SRF_RETURN_DONE(_funcctx)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
#define ItemIdIsUsed(itemId)
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
void pfree(void *pointer)
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
Page get_page_from_raw(bytea *raw_page)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static Datum Int64GetDatum(int64 X)
static Datum PointerGetDatum(const void *X)
static Datum UInt16GetDatum(uint16 X)
static Datum BoolGetDatum(bool X)
static Datum Int32GetDatum(int32 X)
static Datum UInt32GetDatum(uint32 X)
char * psprintf(const char *fmt,...)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
BlockNumber lastRevmapPage
BlockNumber pagesPerRange
FmgrInfo outputFn[FLEXIBLE_ARRAY_MEMBER]
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)
text * cstring_to_text(const char *s)