39 .
name =
"tupdesc reference",
79 switch (src->attalign)
95 elog(
ERROR,
"invalid attalign value: %c", src->attalign);
134#ifdef USE_ASSERT_CHECKING
218 for (
i = 0;
i < natts; ++
i)
254 att->attnotnull =
false;
255 att->atthasdef =
false;
256 att->atthasmissing =
false;
257 att->attidentity =
'\0';
258 att->attgenerated =
'\0';
283 Assert(natts <= tupdesc->natts);
300 att->attnotnull =
false;
301 att->atthasdef =
false;
302 att->atthasmissing =
false;
303 att->attidentity =
'\0';
304 att->attgenerated =
'\0';
359 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
420 att->attnotnull =
false;
421 att->atthasdef =
false;
422 att->atthasmissing =
false;
423 att->attidentity =
'\0';
424 att->attgenerated =
'\0';
457 Assert(srcAttno <= src->natts);
459 Assert(dstAttno <= dst->natts);
463 dstAtt->attnum = dstAttno;
466 dstAtt->attnotnull =
false;
467 dstAtt->atthasdef =
false;
468 dstAtt->atthasmissing =
false;
469 dstAtt->attidentity =
'\0';
470 dstAtt->attgenerated =
'\0';
503 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
505 if (attrmiss[
i].am_present
579 for (
i = 0;
i < tupdesc1->
natts;
i++)
596 if (strcmp(
NameStr(attr1->attname),
NameStr(attr2->attname)) != 0)
598 if (attr1->atttypid != attr2->atttypid)
600 if (attr1->attlen != attr2->attlen)
602 if (attr1->attndims != attr2->attndims)
604 if (attr1->atttypmod != attr2->atttypmod)
606 if (attr1->attbyval != attr2->attbyval)
608 if (attr1->attalign != attr2->attalign)
610 if (attr1->attstorage != attr2->attstorage)
612 if (attr1->attcompression != attr2->attcompression)
614 if (attr1->attnotnull != attr2->attnotnull)
616 if (attr1->atthasdef != attr2->atthasdef)
618 if (attr1->attidentity != attr2->attidentity)
620 if (attr1->attgenerated != attr2->attgenerated)
622 if (attr1->attisdropped != attr2->attisdropped)
624 if (attr1->attislocal != attr2->attislocal)
626 if (attr1->attinhcount != attr2->attinhcount)
628 if (attr1->attcollation != attr2->attcollation)
633 if (tupdesc1->
constr != NULL)
650 for (
i = 0;
i < n;
i++)
657 if (strcmp(defval1->
adbin, defval2->
adbin) != 0)
664 for (
i = 0;
i < tupdesc1->
natts;
i++)
692 for (
i = 0;
i < n;
i++)
705 else if (tupdesc2->
constr != NULL)
743 for (
int i = 0;
i < tupdesc1->
natts;
i++)
748 if (strcmp(
NameStr(attr1->attname),
NameStr(attr2->attname)) != 0)
750 if (attr1->atttypid != attr2->atttypid)
752 if (attr1->atttypmod != attr2->atttypmod)
754 if (attr1->attcollation != attr2->attcollation)
758 if (attr1->attisdropped != attr2->attisdropped)
803 const char *attributeName,
816 Assert(attributeNumber >= 1);
817 Assert(attributeNumber <= desc->natts);
833 if (attributeName == NULL)
835 else if (attributeName !=
NameStr(att->attname))
838 att->atttypmod = typmod;
840 att->attnum = attributeNumber;
841 att->attndims = attdim;
843 att->attnotnull =
false;
844 att->atthasdef =
false;
845 att->atthasmissing =
false;
846 att->attidentity =
'\0';
847 att->attgenerated =
'\0';
848 att->attisdropped =
false;
849 att->attislocal =
true;
850 att->attinhcount = 0;
855 elog(
ERROR,
"cache lookup failed for type %u", oidtypeid);
858 att->atttypid = oidtypeid;
859 att->attlen = typeForm->typlen;
860 att->attbyval = typeForm->typbyval;
861 att->attalign = typeForm->typalign;
862 att->attstorage = typeForm->typstorage;
864 att->attcollation = typeForm->typcollation;
879 const char *attributeName,
888 Assert(attributeNumber >= 1);
889 Assert(attributeNumber <= desc->natts);
898 Assert(attributeName != NULL);
901 att->atttypmod = typmod;
903 att->attnum = attributeNumber;
904 att->attndims = attdim;
906 att->attnotnull =
false;
907 att->atthasdef =
false;
908 att->atthasmissing =
false;
909 att->attidentity =
'\0';
910 att->attgenerated =
'\0';
911 att->attisdropped =
false;
912 att->attislocal =
true;
913 att->attinhcount = 0;
916 att->atttypid = oidtypeid;
928 att->attbyval =
false;
929 att->attalign = TYPALIGN_INT;
930 att->attstorage = TYPSTORAGE_EXTENDED;
932 att->attcollation = DEFAULT_COLLATION_OID;
937 att->attbyval =
true;
938 att->attalign = TYPALIGN_CHAR;
939 att->attstorage = TYPSTORAGE_PLAIN;
946 att->attbyval =
true;
947 att->attalign = TYPALIGN_INT;
948 att->attstorage = TYPSTORAGE_PLAIN;
956 att->attalign = TYPALIGN_DOUBLE;
957 att->attstorage = TYPSTORAGE_PLAIN;
964 att->attbyval =
true;
965 att->attalign = TYPALIGN_INT;
966 att->attstorage = TYPSTORAGE_PLAIN;
972 elog(
ERROR,
"unsupported type %u", oidtypeid);
993 Assert(attributeNumber >= 1);
994 Assert(attributeNumber <= desc->natts);
996 TupleDescAttr(desc, attributeNumber - 1)->attcollation = collationid;
1031 forfour(l1, names, l2,
types, l3, typmods, l4, collations)
1053 Node *result = NULL;
1061 if (attrdef[
i].adnum ==
attnum)
1090 return psprintf(
"TupleDesc %p (%u,%d)",
#define Assert(condition)
#define PointerIsValid(pointer)
#define MemSet(start, val, len)
Datum datumCopy(Datum value, bool typByVal, int typLen)
bool datumIsEqual(Datum value1, Datum value2, bool typByVal, int typLen)
static void PGresult * res
static Datum hash_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 * 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)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)
struct CompactAttribute CompactAttribute
struct TupleDescData * TupleDesc