16#include "catalog/pg_am_d.h"
31#define IS_BRIN(r) ((r)->rd_rel->relam == BRIN_AM_OID)
52 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
53 errmsg(
"must be superuser to use raw page functions")));
63 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
64 errmsg(
"input page is not a valid %s page",
"BRIN"),
65 errdetail(
"Expected special size %d, got %d.",
103 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
104 errmsg(
"input page is not a valid %s page",
"BRIN"),
105 errdetail(
"Expected special size %d, got %d.",
112 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
113 errmsg(
"page is not a BRIN page of type \"%s\"", strtype),
114 errdetail(
"Expected special type %08x, got %08x.",
121#define BRIN_PAGE_ITEMS_V1_12 8
145 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
146 errmsg(
"must be superuser to use raw page functions")));
161 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
162 errmsg(
"function has wrong number of declared columns"),
163 errhint(
"To resolve the problem, update the \"pageinspect\" extension to the latest version.")));
169 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
170 errmsg(
"\"%s\" is not a %s index",
190 for (attno = 1; attno <= bdesc->bd_tupdesc->natts; attno++)
198 opcinfo = bdesc->bd_info[attno - 1];
209 columns[attno - 1] = column;
279 if (!dtup->bt_columns[att].bv_allnulls)
290 for (
i = 0;
i < columns[att]->nstored;
i++)
322 else if (attno >= bdesc->bd_tupdesc->natts)
355 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
356 errmsg(
"must be superuser to use raw page functions")));
365 elog(
ERROR,
"return type must be a row type");
395 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
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)
PG_FUNCTION_INFO_V1(brin_page_type)
struct brin_column_state brin_column_state
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 Item PageGetItem(const PageData *page, const ItemIdData *itemId)
static bool PageIsNew(const PageData *page)
static char * PageGetContents(Page page)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
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)
void fmgr_info(Oid functionId, FmgrInfo *finfo)
Datum Int64GetDatum(int64 X)
char * OutputFunctionCall(FmgrInfo *flinfo, Datum val)
#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)
if(TABLE==NULL||TABLE_index==NULL)
#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 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
TypeCacheEntry * oi_typcache[FLEXIBLE_ARRAY_MEMBER]
MemoryContext multi_call_memory_ctx
Tuplestorestate * setResult
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)