19 #include "catalog/pg_am_d.h"
35 #define IS_BRIN(r) ((r)->rd_rel->relam == BRIN_AM_OID)
56 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
57 errmsg(
"must be superuser to use raw page functions")));
67 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
68 errmsg(
"input page is not a valid %s page",
"BRIN"),
69 errdetail(
"Expected special size %d, got %d.",
107 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
108 errmsg(
"input page is not a valid %s page",
"BRIN"),
109 errdetail(
"Expected special size %d, got %d.",
116 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
117 errmsg(
"page is not a BRIN page of type \"%s\"", strtype),
118 errdetail(
"Expected special type %08x, got %08x.",
147 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
148 errmsg(
"must be superuser to use raw page functions")));
156 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
157 errmsg(
"\"%s\" is not a %s index",
177 for (attno = 1; attno <= bdesc->bd_tupdesc->natts; attno++)
185 opcinfo = bdesc->bd_info[attno - 1];
196 columns[attno - 1] = column;
266 if (!dtup->bt_columns[att].bv_allnulls)
277 for (
i = 0;
i < columns[att]->nstored;
i++)
309 else if (attno >= bdesc->bd_tupdesc->natts)
342 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
343 errmsg(
"must be superuser to use raw page functions")));
352 elog(
ERROR,
"return type must be a row type");
382 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
383 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)
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 char * PageGetContents(Page page)
static Item PageGetItem(Page page, ItemId itemId)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static bool PageIsNew(Page page)
static OffsetNumber PageGetMaxOffsetNumber(Page page)
static uint16 PageGetSpecialSize(Page page)
#define CStringGetTextDatum(s)
#define FLEXIBLE_ARRAY_MEMBER
int errdetail(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 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,...)
MemoryContextSwitchTo(old_ctx)
#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]
#define TupleDescAttr(tupdesc, i)
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)
text * cstring_to_text(const char *s)