17 #include "catalog/pg_am_d.h"
34 #define IS_GIST(r) ((r)->rd_rel->relam == GIST_AM_OID)
55 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
56 errmsg(
"input page is not a valid %s page",
"GiST"),
57 errdetail(
"Expected special size %d, got %d.",
64 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
65 errmsg(
"input page is not a valid %s page",
"GiST"),
88 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
89 errmsg(
"must be superuser to use raw page functions")));
98 elog(
ERROR,
"return type must be a row type");
119 memset(nulls, 0,
sizeof(nulls));
143 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
144 errmsg(
"must be superuser to use raw page functions")));
178 memset(nulls, 0,
sizeof(nulls));
186 memcpy(
VARDATA(tuple_bytea), itup, tuple_len);
213 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
214 errmsg(
"must be superuser to use raw page functions")));
223 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
224 errmsg(
"\"%s\" is not a %s index",
283 itup_values, itup_isnull);
285 memset(nulls, 0,
sizeof(nulls));
298 for (
i = 0;
i < tupdesc->natts;
i++)
323 nq = (
value[0] ==
'\0');
324 for (tmp =
value; *tmp; tmp++)
328 if (ch ==
'"' || ch ==
'\\' ||
329 ch ==
'(' || ch ==
')' || ch ==
',' ||
330 isspace((
unsigned char) ch))
340 for (tmp =
value; *tmp; tmp++)
344 if (ch ==
'"' || ch ==
'\\')
ArrayType * construct_array_builtin(Datum *elems, int nelems, Oid elmtype)
static Datum values[MAXATTR]
static Item PageGetItem(Page page, ItemId itemId)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static bool PageIsNew(Page page)
static XLogRecPtr PageGetLSN(const char *page)
static OffsetNumber PageGetMaxOffsetNumber(Page page)
static uint16 PageGetSpecialSize(Page page)
#define CStringGetTextDatum(s)
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
Datum Int64GetDatum(int64 X)
char * OidOutputFunctionCall(Oid functionId, Datum val)
#define DirectFunctionCall1(func, arg1)
#define PG_GETARG_BYTEA_P(n)
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
#define GistPageIsDeleted(page)
#define GistPageGetOpaque(page)
#define GistPageGetNSN(page)
PG_FUNCTION_INFO_V1(gist_page_opaque_info)
Datum gist_page_items_bytea(PG_FUNCTION_ARGS)
static Page verify_gist_page(bytea *raw_page)
Datum gist_page_items(PG_FUNCTION_ARGS)
Datum gist_page_opaque_info(PG_FUNCTION_ARGS)
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)
void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor, Datum *values, bool *isnull)
if(TABLE==NULL||TABLE_index==NULL)
#define ItemIdIsDead(itemId)
#define ItemIdIsValid(itemId)
static Datum ItemPointerGetDatum(const ItemPointerData *X)
IndexTupleData * IndexTuple
#define IndexTupleSize(itup)
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
#define InvalidOffsetNumber
#define FirstOffsetNumber
Page get_page_from_raw(bytea *raw_page)
static Datum LSNGetDatum(XLogRecPtr X)
static Datum PointerGetDatum(const void *X)
static Datum BoolGetDatum(bool X)
static Datum Int32GetDatum(int32 X)
static int16 DatumGetInt16(Datum X)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
#define IndexRelationGetNumberOfKeyAttributes(relation)
char * pg_get_indexdef_columns_extended(Oid indexrelid, bits16 flags)
#define RULE_INDEXDEF_PRETTY
#define RULE_INDEXDEF_KEYS_ONLY
void relation_close(Relation relation, LOCKMODE lockmode)
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
#define appendStringInfoCharMacro(str, ch)
Tuplestorestate * setResult
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
#define TupleDescAttr(tupdesc, i)
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)
#define SET_VARSIZE(PTR, len)
Datum to_hex32(PG_FUNCTION_ARGS)