54 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
55 (
errmsg(
"must be superuser to use raw page functions"))));
59 if (raw_page_size != BLCKSZ)
61 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
62 errmsg(
"input page too small"),
64 BLCKSZ, raw_page_size)));
97 if (raw_page_size != BLCKSZ)
99 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
100 errmsg(
"input page too small"),
102 BLCKSZ, raw_page_size)));
109 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
110 errmsg(
"page is not a BRIN page of type \"%s\"", strtype),
111 errdetail(
"Expected special type %08x, got %08x.",
143 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
144 (
errmsg(
"must be superuser to use raw page functions"))));
149 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
150 errmsg(
"set-valued function called in context that cannot accept a set")));
154 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
155 errmsg(
"materialize mode required, but it is not allowed in this context")));
159 elog(
ERROR,
"return type must be a row type");
182 for (attno = 1; attno <= bdesc->bd_tupdesc->natts; attno++)
190 opcinfo = bdesc->bd_info[attno - 1];
201 columns[attno - 1] = column;
238 MemSet(nulls, 0,
sizeof(nulls));
257 values[3] =
BoolGetDatum(dtup->bt_columns[att].bv_allnulls);
258 values[4] =
BoolGetDatum(dtup->bt_columns[att].bv_hasnulls);
260 if (!dtup->bt_columns[att].bv_allnulls)
271 for (i = 0; i < columns[att]->nstored; i++)
303 else if (attno >= bdesc->bd_tupdesc->natts)
338 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
339 (
errmsg(
"must be superuser to use raw page functions"))));
345 elog(
ERROR,
"return type must be a row type");
350 MemSet(nulls, 0,
sizeof(nulls));
376 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
377 (
errmsg(
"must be superuser to use raw page functions"))));
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, Datum *values, bool *isnull)
void brin_free_desc(BrinDesc *bdesc)
#define IsA(nodeptr, _type_)
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
#define RelationGetDescr(relation)
static void output(uint64 loop_count)
#define SRF_IS_FIRSTCALL()
#define PointerGetDatum(X)
Datum brin_page_type(PG_FUNCTION_ARGS)
char * psprintf(const char *fmt,...)
#define ItemIdIsUsed(itemId)
FmgrInfo outputFn[FLEXIBLE_ARRAY_MEMBER]
#define tuplestore_donestoring(state)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
int errcode(int sqlerrcode)
#define MemSet(start, val, len)
Datum idx(PG_FUNCTION_ARGS)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
#define PageGetMaxOffsetNumber(page)
#define SRF_PERCALL_SETUP()
char * OutputFunctionCall(FmgrInfo *flinfo, Datum val)
#define SRF_RETURN_NEXT(_funcctx, _result)
BrinMemTuple * brin_deform_tuple(BrinDesc *brdesc, BrinTuple *tuple, BrinMemTuple *dMemtuple)
#define PG_GETARG_BYTEA_P(n)
void pfree(void *pointer)
TypeCacheEntry * oi_typcache[FLEXIBLE_ARRAY_MEMBER]
PG_FUNCTION_INFO_V1(brin_page_type)
#define BRIN_PAGETYPE_META
void fmgr_info(Oid functionId, FmgrInfo *finfo)
#define BRIN_PAGETYPE_REGULAR
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
void appendStringInfoString(StringInfo str, const char *s)
Datum brin_metapage_info(PG_FUNCTION_ARGS)
#define FirstOffsetNumber
int errdetail(const char *fmt,...)
Datum brin_page_items(PG_FUNCTION_ARGS)
#define UInt32GetDatum(X)
Datum Int64GetDatum(int64 X)
#define ereport(elevel, rest)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
#define PageGetItemId(page, offsetNumber)
BlockNumber lastRevmapPage
Tuplestorestate * tuplestore_begin_heap(bool randomAccess, bool interXact, int maxKBytes)
#define PageGetContents(page)
#define PG_RETURN_DATUM(x)
#define REVMAP_PAGE_MAXITEMS
BlockNumber pagesPerRange
#define PG_RETURN_TEXT_P(x)
SetFunctionReturnMode returnMode
text * cstring_to_text(const char *s)
BrinDesc * brin_build_desc(Relation rel)
MemoryContext multi_call_memory_ctx
#define BRIN_PAGETYPE_REVMAP
#define OffsetNumberNext(offsetNumber)
Datum brin_revmap_data(PG_FUNCTION_ARGS)
#define HeapTupleGetDatum(tuple)
MemoryContext ecxt_per_query_memory
#define BrinPageType(page)
void index_close(Relation relation, LOCKMODE lockmode)
Tuplestorestate * setResult
static Datum values[MAXATTR]
int errmsg(const char *fmt,...)
#define CStringGetTextDatum(s)
static Page verify_brin_page(bytea *raw_page, uint16 type, const char *strtype)
#define UInt16GetDatum(X)
struct brin_column_state brin_column_state
Relation index_open(Oid relationId, LOCKMODE lockmode)
#define offsetof(type, field)
#define PageGetItem(page, itemId)
#define SRF_RETURN_DONE(_funcctx)
#define SRF_FIRSTCALL_INIT()