40 .
name =
"tupdesc reference",
70 dst->attcacheoff = -1;
71 dst->attlen = src->attlen;
73 dst->attbyval = src->attbyval;
75 dst->atthasmissing = src->atthasmissing;
76 dst->attisdropped = src->attisdropped;
77 dst->attgenerated = (src->attgenerated !=
'\0');
127#ifdef USE_ASSERT_CHECKING
223 for (
i = 0;
i < natts; ++
i)
263 att->attnotnull =
false;
264 att->atthasdef =
false;
265 att->atthasmissing =
false;
266 att->attidentity =
'\0';
267 att->attgenerated =
'\0';
312 att->attnotnull =
false;
313 att->atthasdef =
false;
314 att->atthasmissing =
false;
315 att->attidentity =
'\0';
316 att->attgenerated =
'\0';
371 for (
i =
cpy->num_defval - 1;
i >= 0;
i--)
379 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
396 for (
i =
cpy->num_check - 1;
i >= 0;
i--)
438 for (
i = 0;
i <
dst->natts;
i++)
442 att->attnotnull =
false;
443 att->atthasdef =
false;
444 att->atthasmissing =
false;
445 att->attidentity =
'\0';
446 att->attgenerated =
'\0';
456 dst->tdrefcount = -1;
493 dstAtt->attnotnull =
false;
494 dstAtt->atthasdef =
false;
495 dstAtt->atthasmissing =
false;
496 dstAtt->attidentity =
'\0';
497 dstAtt->attgenerated =
'\0';
513 int firstNonCachedOffsetAttr = 0;
514 int firstNonGuaranteedAttr = tupdesc->
natts;
517 for (
int i = 0;
i < tupdesc->
natts;
i++)
527 if (firstNonGuaranteedAttr == tupdesc->
natts &&
529 cattr->atthasmissing ||
cattr->attisdropped ||
530 cattr->attlen <= 0 ||
532 firstNonGuaranteedAttr =
i;
539 if (
cattr->attlen <= 0 ||
557 off +=
cattr->attlen;
558 firstNonCachedOffsetAttr =
i + 1;
593 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
702 if (
attr1->attcompression !=
attr2->attcompression)
712 if (
attr1->attnotnull)
728 if (
attr1->attgenerated !=
attr2->attgenerated)
730 if (
attr1->attisdropped !=
attr2->attisdropped)
736 if (
attr1->attcollation !=
attr2->attcollation)
750 if (
constr1->has_generated_stored !=
constr2->has_generated_stored)
752 if (
constr1->has_generated_virtual !=
constr2->has_generated_virtual)
755 if (n != (
int)
constr2->num_defval)
758 for (
i = 0;
i < n;
i++)
792 if (n != (
int)
constr2->num_check)
800 for (
i = 0;
i < n;
i++)
862 if (
attr1->attcollation !=
attr2->attcollation)
866 if (
attr1->attisdropped !=
attr2->attisdropped)
946 att->atttypmod = typmod;
951 att->attnotnull =
false;
952 att->atthasdef =
false;
953 att->atthasmissing =
false;
954 att->attidentity =
'\0';
955 att->attgenerated =
'\0';
956 att->attisdropped =
false;
957 att->attislocal =
true;
958 att->attinhcount = 0;
970 att->attstorage =
typeForm->typstorage;
972 att->attcollation =
typeForm->typcollation;
1009 att->atttypmod = typmod;
1014 att->attnotnull =
false;
1015 att->atthasdef =
false;
1016 att->atthasmissing =
false;
1017 att->attidentity =
'\0';
1018 att->attgenerated =
'\0';
1019 att->attisdropped =
false;
1020 att->attislocal =
true;
1021 att->attinhcount = 0;
1036 att->attbyval =
false;
1045 att->attbyval =
true;
1054 att->attbyval =
true;
1063 att->attbyval =
true;
1072 att->attbyval =
true;
1139 forfour(l1, names, l2,
types, l3, typmods, l4, collations)
1200 return psprintf(
"TupleDesc %p (%u,%d)",
#define Assert(condition)
#define MemSet(start, val, len)
bool IsCatalogRelationOid(Oid relid)
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
Datum datumCopy(Datum value, bool typByVal, int typLen)
bool datumIsEqual(Datum value1, Datum value2, bool typByVal, int typLen)
#define palloc0_object(type)
uint32 hash_bytes_uint32(uint32 k)
static uint32 hash_combine(uint32 a, uint32 b)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
char * pstrdup(const char *in)
void pfree(void *pointer)
void namestrcpy(Name name, const char *str)
#define ATTRIBUTE_FIXED_PART_SIZE
FormData_pg_attribute * Form_pg_attribute
static int list_length(const List *l)
#define forfour(cell1, list1, cell2, list2, cell3, list3, cell4, list4)
END_CATALOG_STRUCT typedef FormData_pg_type * Form_pg_type
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
#define PointerGetDatum(X)
char * psprintf(const char *fmt,...)
void * stringToNode(const char *str)
ResourceOwner CurrentResourceOwner
void ResourceOwnerForget(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind)
void ResourceOwnerRemember(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind)
void ResourceOwnerEnlarge(ResourceOwner owner)
@ RESOURCE_RELEASE_AFTER_LOCKS
#define RELEASE_PRIO_TUPDESC_REFS
bool has_generated_virtual
bool has_generated_stored
struct AttrMissing * missing
int firstNonCachedOffsetAttr
CompactAttribute compact_attrs[FLEXIBLE_ARRAY_MEMBER]
int firstNonGuaranteedAttr
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
#define InvalidCompressionMethod
TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc)
void TupleDescCopy(TupleDesc dst, TupleDesc src)
static void populate_compact_attribute_internal(Form_pg_attribute src, CompactAttribute *dst)
Node * TupleDescGetDefault(TupleDesc tupdesc, AttrNumber attnum)
void DecrTupleDescRefCount(TupleDesc tupdesc)
void FreeTupleDesc(TupleDesc tupdesc)
void IncrTupleDescRefCount(TupleDesc tupdesc)
void verify_compact_attribute(TupleDesc tupdesc, int attnum)
TupleDesc CreateTemplateTupleDesc(int natts)
static void ResourceOwnerRememberTupleDesc(ResourceOwner owner, TupleDesc tupdesc)
static void ResourceOwnerForgetTupleDesc(ResourceOwner owner, TupleDesc tupdesc)
void TupleDescFinalize(TupleDesc tupdesc)
static void ResOwnerReleaseTupleDesc(Datum res)
uint32 hashRowType(TupleDesc desc)
TupleDesc CreateTupleDescTruncatedCopy(TupleDesc tupdesc, int natts)
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
void TupleDescInitBuiltinEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
static const ResourceOwnerDesc tupdesc_resowner_desc
TupleDesc BuildDescFromLists(const List *names, const List *types, const List *typmods, const List *collations)
void populate_compact_attribute(TupleDesc tupdesc, int attnum)
bool equalRowTypes(TupleDesc tupdesc1, TupleDesc tupdesc2)
void TupleDescInitEntryCollation(TupleDesc desc, AttrNumber attributeNumber, Oid collationid)
TupleDesc CreateTupleDesc(int natts, Form_pg_attribute *attrs)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
void TupleDescCopyEntry(TupleDesc dst, AttrNumber dstAttno, TupleDesc src, AttrNumber srcAttno)
static char * ResOwnerPrintTupleDesc(Datum res)
#define TupleDescSize(src)
#define ATTNULLABLE_UNKNOWN
#define ATTNULLABLE_VALID
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)
struct TupleDescData * TupleDesc
#define ATTNULLABLE_UNRESTRICTED
#define att_nominal_alignby(cur_offset, attalignby)
static uint8 typalign_to_alignby(char typalign)