40 .
name =
"tupdesc reference",
89 switch (src->attalign)
105 elog(
ERROR,
"invalid attalign value: %c", src->attalign);
144#ifdef USE_ASSERT_CHECKING
229 for (
i = 0;
i < natts; ++
i)
265 att->attnotnull =
false;
266 att->atthasdef =
false;
267 att->atthasmissing =
false;
268 att->attidentity =
'\0';
269 att->attgenerated =
'\0';
294 Assert(natts <= tupdesc->natts);
311 att->attnotnull =
false;
312 att->atthasdef =
false;
313 att->atthasmissing =
false;
314 att->attidentity =
'\0';
315 att->attgenerated =
'\0';
375 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
436 att->attnotnull =
false;
437 att->atthasdef =
false;
438 att->atthasmissing =
false;
439 att->attidentity =
'\0';
440 att->attgenerated =
'\0';
473 Assert(srcAttno <= src->natts);
475 Assert(dstAttno <= dst->natts);
479 dstAtt->attnum = dstAttno;
482 dstAtt->attnotnull =
false;
483 dstAtt->atthasdef =
false;
484 dstAtt->atthasmissing =
false;
485 dstAtt->attidentity =
'\0';
486 dstAtt->attgenerated =
'\0';
519 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
521 if (attrmiss[
i].am_present
595 for (
i = 0;
i < tupdesc1->
natts;
i++)
612 if (strcmp(
NameStr(attr1->attname),
NameStr(attr2->attname)) != 0)
614 if (attr1->atttypid != attr2->atttypid)
616 if (attr1->attlen != attr2->attlen)
618 if (attr1->attndims != attr2->attndims)
620 if (attr1->atttypmod != attr2->atttypmod)
622 if (attr1->attbyval != attr2->attbyval)
624 if (attr1->attalign != attr2->attalign)
626 if (attr1->attstorage != attr2->attstorage)
628 if (attr1->attcompression != attr2->attcompression)
630 if (attr1->attnotnull != attr2->attnotnull)
638 if (attr1->attnotnull)
650 if (attr1->atthasdef != attr2->atthasdef)
652 if (attr1->attidentity != attr2->attidentity)
654 if (attr1->attgenerated != attr2->attgenerated)
656 if (attr1->attisdropped != attr2->attisdropped)
658 if (attr1->attislocal != attr2->attislocal)
660 if (attr1->attinhcount != attr2->attinhcount)
662 if (attr1->attcollation != attr2->attcollation)
667 if (tupdesc1->
constr != NULL)
684 for (
i = 0;
i < n;
i++)
691 if (strcmp(defval1->
adbin, defval2->
adbin) != 0)
698 for (
i = 0;
i < tupdesc1->
natts;
i++)
726 for (
i = 0;
i < n;
i++)
739 else if (tupdesc2->
constr != NULL)
777 for (
int i = 0;
i < tupdesc1->
natts;
i++)
782 if (strcmp(
NameStr(attr1->attname),
NameStr(attr2->attname)) != 0)
784 if (attr1->atttypid != attr2->atttypid)
786 if (attr1->atttypmod != attr2->atttypmod)
788 if (attr1->attcollation != attr2->attcollation)
792 if (attr1->attisdropped != attr2->attisdropped)
837 const char *attributeName,
850 Assert(attributeNumber >= 1);
851 Assert(attributeNumber <= desc->natts);
867 if (attributeName == NULL)
869 else if (attributeName !=
NameStr(att->attname))
872 att->atttypmod = typmod;
874 att->attnum = attributeNumber;
875 att->attndims = attdim;
877 att->attnotnull =
false;
878 att->atthasdef =
false;
879 att->atthasmissing =
false;
880 att->attidentity =
'\0';
881 att->attgenerated =
'\0';
882 att->attisdropped =
false;
883 att->attislocal =
true;
884 att->attinhcount = 0;
889 elog(
ERROR,
"cache lookup failed for type %u", oidtypeid);
892 att->atttypid = oidtypeid;
893 att->attlen = typeForm->typlen;
894 att->attbyval = typeForm->typbyval;
895 att->attalign = typeForm->typalign;
896 att->attstorage = typeForm->typstorage;
898 att->attcollation = typeForm->typcollation;
913 const char *attributeName,
922 Assert(attributeNumber >= 1);
923 Assert(attributeNumber <= desc->natts);
932 Assert(attributeName != NULL);
935 att->atttypmod = typmod;
937 att->attnum = attributeNumber;
938 att->attndims = attdim;
940 att->attnotnull =
false;
941 att->atthasdef =
false;
942 att->atthasmissing =
false;
943 att->attidentity =
'\0';
944 att->attgenerated =
'\0';
945 att->attisdropped =
false;
946 att->attislocal =
true;
947 att->attinhcount = 0;
950 att->atttypid = oidtypeid;
962 att->attbyval =
false;
963 att->attalign = TYPALIGN_INT;
964 att->attstorage = TYPSTORAGE_EXTENDED;
966 att->attcollation = DEFAULT_COLLATION_OID;
971 att->attbyval =
true;
972 att->attalign = TYPALIGN_CHAR;
973 att->attstorage = TYPSTORAGE_PLAIN;
980 att->attbyval =
true;
981 att->attalign = TYPALIGN_INT;
982 att->attstorage = TYPSTORAGE_PLAIN;
990 att->attalign = TYPALIGN_DOUBLE;
991 att->attstorage = TYPSTORAGE_PLAIN;
998 att->attbyval =
true;
999 att->attalign = TYPALIGN_INT;
1000 att->attstorage = TYPSTORAGE_PLAIN;
1006 elog(
ERROR,
"unsupported type %u", oidtypeid);
1027 Assert(attributeNumber >= 1);
1028 Assert(attributeNumber <= desc->natts);
1030 TupleDescAttr(desc, attributeNumber - 1)->attcollation = collationid;
1065 forfour(l1, names, l2,
types, l3, typmods, l4, collations)
1087 Node *result = NULL;
1095 if (attrdef[
i].adnum ==
attnum)
1124 return psprintf(
"TupleDesc %p (%u,%d)",
#define PointerIsValid(pointer)
#define MemSet(start, val, len)
bool IsCatalogRelationOid(Oid relid)
Datum datumCopy(Datum value, bool typByVal, int typLen)
bool datumIsEqual(Datum value1, Datum value2, bool typByVal, int typLen)
static Datum hash_uint32(uint32 k)
static uint32 hash_combine(uint32 a, uint32 b)
Assert(PointerIsAligned(start, uint64))
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
char * pstrdup(const char *in)
void pfree(void *pointer)
void * palloc0(Size size)
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)
FormData_pg_type * Form_pg_type
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum 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
CompactAttribute compact_attrs[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int 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)
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 CompactAttribute CompactAttribute
struct TupleDescData * TupleDesc
#define ATTNULLABLE_UNRESTRICTED