40 .
name =
"tupdesc reference",
89 switch (src->attalign)
105 elog(
ERROR,
"invalid attalign value: %c", src->attalign);
144#ifdef USE_ASSERT_CHECKING
236 for (
i = 0;
i < natts; ++
i)
272 att->attnotnull =
false;
273 att->atthasdef =
false;
274 att->atthasmissing =
false;
275 att->attidentity =
'\0';
276 att->attgenerated =
'\0';
301 Assert(natts <= tupdesc->natts);
318 att->attnotnull =
false;
319 att->atthasdef =
false;
320 att->atthasmissing =
false;
321 att->attidentity =
'\0';
322 att->attgenerated =
'\0';
382 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
443 att->attnotnull =
false;
444 att->atthasdef =
false;
445 att->atthasmissing =
false;
446 att->attidentity =
'\0';
447 att->attgenerated =
'\0';
480 Assert(srcAttno <= src->natts);
482 Assert(dstAttno <= dst->natts);
486 dstAtt->attnum = dstAttno;
489 dstAtt->attnotnull =
false;
490 dstAtt->atthasdef =
false;
491 dstAtt->atthasmissing =
false;
492 dstAtt->attidentity =
'\0';
493 dstAtt->attgenerated =
'\0';
526 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
528 if (attrmiss[
i].am_present
602 for (
i = 0;
i < tupdesc1->
natts;
i++)
619 if (strcmp(
NameStr(attr1->attname),
NameStr(attr2->attname)) != 0)
621 if (attr1->atttypid != attr2->atttypid)
623 if (attr1->attlen != attr2->attlen)
625 if (attr1->attndims != attr2->attndims)
627 if (attr1->atttypmod != attr2->atttypmod)
629 if (attr1->attbyval != attr2->attbyval)
631 if (attr1->attalign != attr2->attalign)
633 if (attr1->attstorage != attr2->attstorage)
635 if (attr1->attcompression != attr2->attcompression)
637 if (attr1->attnotnull != attr2->attnotnull)
645 if (attr1->attnotnull)
657 if (attr1->atthasdef != attr2->atthasdef)
659 if (attr1->attidentity != attr2->attidentity)
661 if (attr1->attgenerated != attr2->attgenerated)
663 if (attr1->attisdropped != attr2->attisdropped)
665 if (attr1->attislocal != attr2->attislocal)
667 if (attr1->attinhcount != attr2->attinhcount)
669 if (attr1->attcollation != attr2->attcollation)
674 if (tupdesc1->
constr != NULL)
691 for (
i = 0;
i < n;
i++)
698 if (strcmp(defval1->
adbin, defval2->
adbin) != 0)
705 for (
i = 0;
i < tupdesc1->
natts;
i++)
733 for (
i = 0;
i < n;
i++)
746 else if (tupdesc2->
constr != NULL)
784 for (
int i = 0;
i < tupdesc1->
natts;
i++)
789 if (strcmp(
NameStr(attr1->attname),
NameStr(attr2->attname)) != 0)
791 if (attr1->atttypid != attr2->atttypid)
793 if (attr1->atttypmod != attr2->atttypmod)
795 if (attr1->attcollation != attr2->attcollation)
799 if (attr1->attisdropped != attr2->attisdropped)
844 const char *attributeName,
857 Assert(attributeNumber >= 1);
858 Assert(attributeNumber <= desc->natts);
874 if (attributeName == NULL)
876 else if (attributeName !=
NameStr(att->attname))
879 att->atttypmod = typmod;
881 att->attnum = attributeNumber;
882 att->attndims = attdim;
884 att->attnotnull =
false;
885 att->atthasdef =
false;
886 att->atthasmissing =
false;
887 att->attidentity =
'\0';
888 att->attgenerated =
'\0';
889 att->attisdropped =
false;
890 att->attislocal =
true;
891 att->attinhcount = 0;
896 elog(
ERROR,
"cache lookup failed for type %u", oidtypeid);
899 att->atttypid = oidtypeid;
900 att->attlen = typeForm->typlen;
901 att->attbyval = typeForm->typbyval;
902 att->attalign = typeForm->typalign;
903 att->attstorage = typeForm->typstorage;
905 att->attcollation = typeForm->typcollation;
920 const char *attributeName,
929 Assert(attributeNumber >= 1);
930 Assert(attributeNumber <= desc->natts);
939 Assert(attributeName != NULL);
942 att->atttypmod = typmod;
944 att->attnum = attributeNumber;
945 att->attndims = attdim;
947 att->attnotnull =
false;
948 att->atthasdef =
false;
949 att->atthasmissing =
false;
950 att->attidentity =
'\0';
951 att->attgenerated =
'\0';
952 att->attisdropped =
false;
953 att->attislocal =
true;
954 att->attinhcount = 0;
957 att->atttypid = oidtypeid;
969 att->attbyval =
false;
970 att->attalign = TYPALIGN_INT;
971 att->attstorage = TYPSTORAGE_EXTENDED;
973 att->attcollation = DEFAULT_COLLATION_OID;
978 att->attbyval =
true;
979 att->attalign = TYPALIGN_CHAR;
980 att->attstorage = TYPSTORAGE_PLAIN;
987 att->attbyval =
true;
988 att->attalign = TYPALIGN_INT;
989 att->attstorage = TYPSTORAGE_PLAIN;
996 att->attbyval =
true;
997 att->attalign = TYPALIGN_DOUBLE;
998 att->attstorage = TYPSTORAGE_PLAIN;
1005 att->attbyval =
true;
1006 att->attalign = TYPALIGN_INT;
1007 att->attstorage = TYPSTORAGE_PLAIN;
1013 elog(
ERROR,
"unsupported type %u", oidtypeid);
1034 Assert(attributeNumber >= 1);
1035 Assert(attributeNumber <= desc->natts);
1037 TupleDescAttr(desc, attributeNumber - 1)->attcollation = collationid;
1072 forfour(l1, names, l2,
types, l3, typmods, l4, collations)
1094 Node *result = NULL;
1102 if (attrdef[
i].adnum ==
attnum)
1131 return psprintf(
"TupleDesc %p (%u,%d)",
#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)
uint32 hash_bytes_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