39 .
name =
"tupdesc reference",
119 for (
i = 0;
i < natts; ++
i)
153 att->attnotnull =
false;
154 att->atthasdef =
false;
155 att->atthasmissing =
false;
156 att->attidentity =
'\0';
157 att->attgenerated =
'\0';
206 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
266 att->attnotnull =
false;
267 att->atthasdef =
false;
268 att->atthasmissing =
false;
269 att->attidentity =
'\0';
270 att->attgenerated =
'\0';
301 Assert(srcAttno <= src->natts);
303 Assert(dstAttno <= dst->natts);
316 dstAtt->attnum = dstAttno;
317 dstAtt->attcacheoff = -1;
320 dstAtt->attnotnull =
false;
321 dstAtt->atthasdef =
false;
322 dstAtt->atthasmissing =
false;
323 dstAtt->attidentity =
'\0';
324 dstAtt->attgenerated =
'\0';
355 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
357 if (attrmiss[
i].am_present
431 for (
i = 0;
i < tupdesc1->
natts;
i++)
449 if (strcmp(
NameStr(attr1->attname),
NameStr(attr2->attname)) != 0)
451 if (attr1->atttypid != attr2->atttypid)
453 if (attr1->attlen != attr2->attlen)
455 if (attr1->attndims != attr2->attndims)
457 if (attr1->atttypmod != attr2->atttypmod)
459 if (attr1->attbyval != attr2->attbyval)
461 if (attr1->attalign != attr2->attalign)
463 if (attr1->attstorage != attr2->attstorage)
465 if (attr1->attcompression != attr2->attcompression)
467 if (attr1->attnotnull != attr2->attnotnull)
469 if (attr1->atthasdef != attr2->atthasdef)
471 if (attr1->attidentity != attr2->attidentity)
473 if (attr1->attgenerated != attr2->attgenerated)
475 if (attr1->attisdropped != attr2->attisdropped)
477 if (attr1->attislocal != attr2->attislocal)
479 if (attr1->attinhcount != attr2->attinhcount)
481 if (attr1->attcollation != attr2->attcollation)
486 if (tupdesc1->
constr != NULL)
501 for (
i = 0;
i < n;
i++)
508 if (strcmp(defval1->
adbin, defval2->
adbin) != 0)
515 for (
i = 0;
i < tupdesc1->
natts;
i++)
527 missatt1->attbyval, missatt1->attlen))
543 for (
i = 0;
i < n;
i++)
555 else if (tupdesc2->
constr != NULL)
593 for (
int i = 0;
i < tupdesc1->
natts;
i++)
598 if (strcmp(
NameStr(attr1->attname),
NameStr(attr2->attname)) != 0)
600 if (attr1->atttypid != attr2->atttypid)
602 if (attr1->atttypmod != attr2->atttypmod)
604 if (attr1->attcollation != attr2->attcollation)
608 if (attr1->attisdropped != attr2->attisdropped)
653 const char *attributeName,
666 Assert(attributeNumber >= 1);
667 Assert(attributeNumber <= desc->natts);
683 if (attributeName == NULL)
685 else if (attributeName !=
NameStr(att->attname))
688 att->attcacheoff = -1;
689 att->atttypmod = typmod;
691 att->attnum = attributeNumber;
692 att->attndims = attdim;
694 att->attnotnull =
false;
695 att->atthasdef =
false;
696 att->atthasmissing =
false;
697 att->attidentity =
'\0';
698 att->attgenerated =
'\0';
699 att->attisdropped =
false;
700 att->attislocal =
true;
701 att->attinhcount = 0;
706 elog(
ERROR,
"cache lookup failed for type %u", oidtypeid);
709 att->atttypid = oidtypeid;
710 att->attlen = typeForm->typlen;
711 att->attbyval = typeForm->typbyval;
712 att->attalign = typeForm->typalign;
713 att->attstorage = typeForm->typstorage;
715 att->attcollation = typeForm->typcollation;
728 const char *attributeName,
737 Assert(attributeNumber >= 1);
738 Assert(attributeNumber <= desc->natts);
747 Assert(attributeName != NULL);
750 att->attcacheoff = -1;
751 att->atttypmod = typmod;
753 att->attnum = attributeNumber;
754 att->attndims = attdim;
756 att->attnotnull =
false;
757 att->atthasdef =
false;
758 att->atthasmissing =
false;
759 att->attidentity =
'\0';
760 att->attgenerated =
'\0';
761 att->attisdropped =
false;
762 att->attislocal =
true;
763 att->attinhcount = 0;
766 att->atttypid = oidtypeid;
778 att->attbyval =
false;
779 att->attalign = TYPALIGN_INT;
780 att->attstorage = TYPSTORAGE_EXTENDED;
782 att->attcollation = DEFAULT_COLLATION_OID;
787 att->attbyval =
true;
788 att->attalign = TYPALIGN_CHAR;
789 att->attstorage = TYPSTORAGE_PLAIN;
796 att->attbyval =
true;
797 att->attalign = TYPALIGN_INT;
798 att->attstorage = TYPSTORAGE_PLAIN;
806 att->attalign = TYPALIGN_DOUBLE;
807 att->attstorage = TYPSTORAGE_PLAIN;
814 att->attbyval =
true;
815 att->attalign = TYPALIGN_INT;
816 att->attstorage = TYPSTORAGE_PLAIN;
822 elog(
ERROR,
"unsupported type %u", oidtypeid);
841 Assert(attributeNumber >= 1);
842 Assert(attributeNumber <= desc->natts);
844 TupleDescAttr(desc, attributeNumber - 1)->attcollation = collationid;
879 forfour(l1, names, l2,
types, l3, typmods, l4, collations)
909 if (attrdef[
i].adnum ==
attnum)
938 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)
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_stored
struct AttrMissing * missing
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define InvalidCompressionMethod
TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc)
void TupleDescCopy(TupleDesc dst, TupleDesc src)
void DecrTupleDescRefCount(TupleDesc tupdesc)
void FreeTupleDesc(TupleDesc tupdesc)
void IncrTupleDescRefCount(TupleDesc tupdesc)
TupleDesc CreateTemplateTupleDesc(int natts)
static void ResourceOwnerRememberTupleDesc(ResourceOwner owner, TupleDesc tupdesc)
static void ResourceOwnerForgetTupleDesc(ResourceOwner owner, TupleDesc tupdesc)
Node * TupleDescGetDefault(TupleDesc tupdesc, AttrNumber attnum)
static void ResOwnerReleaseTupleDesc(Datum res)
uint32 hashRowType(TupleDesc desc)
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)
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)
struct TupleDescData * TupleDesc
#define TupleDescAttr(tupdesc, i)