33 #include "utils/fmgrprotos.h"
55 Node *escontext = fcinfo->context;
71 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
72 errmsg(
"invalid input syntax for type %s: \"%s\"",
76 cvt = strtoul(coord[0], &badp, 10);
77 if (errno || *badp !=
DELIM)
79 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
80 errmsg(
"invalid input syntax for type %s: \"%s\"",
90 if (cvt != (
unsigned long) blockNumber &&
91 cvt != (
unsigned long) ((
int32) blockNumber))
93 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
94 errmsg(
"invalid input syntax for type %s: \"%s\"",
98 cvt = strtoul(coord[1], &badp, 10);
99 if (errno || *badp !=
RDELIM ||
102 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
103 errmsg(
"invalid input syntax for type %s: \"%s\"",
311 if (rel->
rd_rel->relkind == RELKIND_VIEW)
314 if (!RELKIND_HAS_STORAGE(rel->
rd_rel->relkind))
316 errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
317 errmsg(
"cannot look at latest visible tid for relation \"%s.%s\"",
347 for (
i = 0;
i < natts;
i++)
351 if (strcmp(
NameStr(attr->attname),
"ctid") == 0)
353 if (attr->atttypid != TIDOID)
355 errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
356 errmsg(
"ctid isn't of type TID"));
363 errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
364 errmsg(
"currtid cannot handle views with no CTID"));
368 errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
369 errmsg(
"the view has no rules"));
372 rewrite = rulelock->
rules[
i];
380 errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
381 errmsg(
"only one select rule is allowed in views"));
408 elog(
ERROR,
"currtid cannot handle this view");
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define ereport(elevel,...)
#define PG_GETARG_TEXT_PP(n)
#define PG_RETURN_BYTEA_P(x)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_CSTRING(x)
#define PG_GETARG_CSTRING(n)
#define PG_GETARG_INT64(n)
#define PG_RETURN_INT32(x)
#define PG_RETURN_BOOL(x)
static Datum hash_any_extended(const unsigned char *k, int keylen, uint64 seed)
static Datum hash_any(const unsigned char *k, int keylen)
if(TABLE==NULL||TABLE_index==NULL)
int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2)
static void ItemPointerSet(ItemPointerData *pointer, BlockNumber blockNumber, OffsetNumber offNum)
#define PG_RETURN_ITEMPOINTER(x)
static OffsetNumber ItemPointerGetOffsetNumberNoCheck(const ItemPointerData *pointer)
#define PG_GETARG_ITEMPOINTER(n)
static BlockNumber ItemPointerGetBlockNumberNoCheck(const ItemPointerData *pointer)
ItemPointerData * ItemPointer
static void ItemPointerCopy(const ItemPointerData *fromPointer, ItemPointerData *toPointer)
char * get_namespace_name(Oid nspid)
char * pstrdup(const char *in)
RangeVar * makeRangeVarFromNameList(const List *names)
#define IsA(nodeptr, _type_)
ObjectType get_relkind_objtype(char relkind)
TargetEntry * get_tle_by_resno(List *tlist, AttrNumber resno)
#define rt_fetch(rangetable_index, rangetable)
FormData_pg_attribute * Form_pg_attribute
static int list_length(const List *l)
#define IS_SPECIAL_VARNO(varno)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
#define RelationGetNamespace(relation)
Snapshot GetLatestSnapshot(void)
void UnregisterSnapshot(Snapshot snapshot)
Snapshot RegisterSnapshot(Snapshot snapshot)
StringInfoData * StringInfo
#define SelfItemPointerAttributeNumber
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode)
void table_tuple_get_latest_tid(TableScanDesc scan, ItemPointer tid)
static void table_endscan(TableScanDesc scan)
static TableScanDesc table_beginscan_tid(Relation rel, Snapshot snapshot)
Datum tidge(PG_FUNCTION_ARGS)
Datum bttidcmp(PG_FUNCTION_ARGS)
Datum currtid_byrelname(PG_FUNCTION_ARGS)
static ItemPointer currtid_internal(Relation rel, ItemPointer tid)
Datum hashtid(PG_FUNCTION_ARGS)
Datum tidlarger(PG_FUNCTION_ARGS)
Datum hashtidextended(PG_FUNCTION_ARGS)
Datum tideq(PG_FUNCTION_ARGS)
Datum tidgt(PG_FUNCTION_ARGS)
Datum tidin(PG_FUNCTION_ARGS)
Datum tidle(PG_FUNCTION_ARGS)
Datum tidsmaller(PG_FUNCTION_ARGS)
Datum tidne(PG_FUNCTION_ARGS)
static ItemPointer currtid_for_view(Relation viewrel, ItemPointer tid)
Datum tidrecv(PG_FUNCTION_ARGS)
Datum tidout(PG_FUNCTION_ARGS)
Datum tidsend(PG_FUNCTION_ARGS)
Datum tidlt(PG_FUNCTION_ARGS)
#define TupleDescAttr(tupdesc, i)
List * textToQualifiedNameList(text *textval)