40 #define DatumGetItemPointer(X) ((ItemPointer) DatumGetPointer(X)) 41 #define ItemPointerGetDatum(X) PointerGetDatum(X) 42 #define PG_GETARG_ITEMPOINTER(n) DatumGetItemPointer(PG_GETARG_DATUM(n)) 43 #define PG_RETURN_ITEMPOINTER(x) return ItemPointerGetDatum(x) 75 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
76 errmsg(
"invalid input syntax for type %s: \"%s\"",
80 blockNumber = strtoul(coord[0], &badp, 10);
81 if (errno || *badp !=
DELIM)
83 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
84 errmsg(
"invalid input syntax for type %s: \"%s\"",
87 hold_offset = strtol(coord[1], &badp, 10);
88 if (errno || *badp !=
RDELIM ||
89 hold_offset > USHRT_MAX || hold_offset < 0)
91 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
92 errmsg(
"invalid input syntax for type %s: \"%s\"",
95 offsetNumber = hold_offset;
120 snprintf(buf,
sizeof(buf),
"(%u,%u)", blockNumber, offsetNumber);
257 return hash_any((
unsigned char *) key,
301 if (rel->
rd_rel->relkind == RELKIND_VIEW)
304 if (!RELKIND_HAS_STORAGE(rel->
rd_rel->relkind))
305 elog(
ERROR,
"cannot look at latest visible tid for relation \"%s.%s\"",
335 for (i = 0; i < natts; i++)
339 if (strcmp(
NameStr(attr->attname),
"ctid") == 0)
341 if (attr->atttypid != TIDOID)
348 elog(
ERROR,
"currtid cannot handle views with no CTID");
352 for (i = 0; i < rulelock->
numLocks; i++)
354 rewrite = rulelock->
rules[
i];
361 elog(
ERROR,
"only one select rule is allowed in views");
388 elog(
ERROR,
"currtid cannot handle this view");
int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2)
Datum tidlt(PG_FUNCTION_ARGS)
#define ItemPointerGetOffsetNumberNoCheck(pointer)
Datum bttidcmp(PG_FUNCTION_ARGS)
#define IsA(nodeptr, _type_)
void table_close(Relation relation, LOCKMODE lockmode)
Snapshot RegisterSnapshot(Snapshot snapshot)
#define RelationGetDescr(relation)
#define PG_GETARG_ITEMPOINTER(n)
Datum tidsmaller(PG_FUNCTION_ARGS)
#define TupleDescAttr(tupdesc, i)
char * pstrdup(const char *in)
Datum hashtidextended(PG_FUNCTION_ARGS)
StringInfoData * StringInfo
#define PG_RETURN_INT32(x)
int errcode(int sqlerrcode)
#define PG_GETARG_POINTER(n)
RangeVar * makeRangeVarFromNameList(List *names)
static ItemPointer currtid_internal(Relation rel, ItemPointer tid)
#define PG_RETURN_BYTEA_P(x)
static Datum hash_any_extended(const unsigned char *k, int keylen, uint64 seed)
#define PG_GETARG_TEXT_PP(n)
ItemPointerData * ItemPointer
static ItemPointer currtid_for_view(Relation viewrel, ItemPointer tid)
Datum tidsend(PG_FUNCTION_ARGS)
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
#define IS_SPECIAL_VARNO(varno)
#define PG_RETURN_ITEMPOINTER(x)
char * get_namespace_name(Oid nspid)
Datum tidrecv(PG_FUNCTION_ARGS)
void table_tuple_get_latest_tid(TableScanDesc scan, ItemPointer tid)
#define RelationGetRelationName(relation)
FormData_pg_attribute * Form_pg_attribute
static Datum hash_any(const unsigned char *k, int keylen)
#define rt_fetch(rangetable_index, rangetable)
List * textToQualifiedNameList(text *textval)
void UnregisterSnapshot(Snapshot snapshot)
Datum tidge(PG_FUNCTION_ARGS)
Datum tidle(PG_FUNCTION_ARGS)
Datum tidlarger(PG_FUNCTION_ARGS)
#define PG_RETURN_BOOL(x)
Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode)
#define ereport(elevel,...)
Datum tidin(PG_FUNCTION_ARGS)
#define PG_RETURN_CSTRING(x)
static int list_length(const List *l)
Snapshot GetLatestSnapshot(void)
AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode)
static void table_endscan(TableScanDesc scan)
static TableScanDesc table_beginscan_tid(Relation rel, Snapshot snapshot)
Datum currtid_byrelname(PG_FUNCTION_ARGS)
int errmsg(const char *fmt,...)
#define ItemPointerGetBlockNumberNoCheck(pointer)
Datum hashtid(PG_FUNCTION_ARGS)
TargetEntry * get_tle_by_resno(List *tlist, AttrNumber resno)
ObjectType get_relkind_objtype(char relkind)
Datum tidgt(PG_FUNCTION_ARGS)
#define PG_GETARG_CSTRING(n)
Datum tidne(PG_FUNCTION_ARGS)
#define SelfItemPointerAttributeNumber
Relation table_open(Oid relationId, LOCKMODE lockmode)
#define PG_GETARG_INT64(n)
Datum tidout(PG_FUNCTION_ARGS)
#define RelationGetRelid(relation)
Datum tideq(PG_FUNCTION_ARGS)
#define ItemPointerSet(pointer, blockNumber, offNum)
#define ItemPointerCopy(fromPointer, toPointer)
#define RelationGetNamespace(relation)