97 for (
i = 0;
i < natts; ++
i)
131 att->attnotnull =
false;
132 att->atthasdef =
false;
133 att->atthasmissing =
false;
134 att->attidentity =
'\0';
135 att->attgenerated =
'\0';
184 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
244 att->attnotnull =
false;
245 att->atthasdef =
false;
246 att->atthasmissing =
false;
247 att->attidentity =
'\0';
248 att->attgenerated =
'\0';
279 Assert(srcAttno <= src->natts);
281 Assert(dstAttno <= dst->natts);
294 dstAtt->attnum = dstAttno;
295 dstAtt->attcacheoff = -1;
298 dstAtt->attnotnull =
false;
299 dstAtt->atthasdef =
false;
300 dstAtt->atthasmissing =
false;
301 dstAtt->attidentity =
'\0';
302 dstAtt->attgenerated =
'\0';
333 for (
i = tupdesc->
natts - 1;
i >= 0;
i--)
335 if (attrmiss[
i].am_present
412 for (
i = 0;
i < tupdesc1->
natts;
i++)
430 if (strcmp(
NameStr(attr1->attname),
NameStr(attr2->attname)) != 0)
432 if (attr1->atttypid != attr2->atttypid)
434 if (attr1->attstattarget != attr2->attstattarget)
436 if (attr1->attlen != attr2->attlen)
438 if (attr1->attndims != attr2->attndims)
440 if (attr1->atttypmod != attr2->atttypmod)
442 if (attr1->attbyval != attr2->attbyval)
444 if (attr1->attalign != attr2->attalign)
446 if (attr1->attstorage != attr2->attstorage)
448 if (attr1->attcompression != attr2->attcompression)
450 if (attr1->attnotnull != attr2->attnotnull)
452 if (attr1->atthasdef != attr2->atthasdef)
454 if (attr1->attidentity != attr2->attidentity)
456 if (attr1->attgenerated != attr2->attgenerated)
458 if (attr1->attisdropped != attr2->attisdropped)
460 if (attr1->attislocal != attr2->attislocal)
462 if (attr1->attinhcount != attr2->attinhcount)
464 if (attr1->attcollation != attr2->attcollation)
469 if (tupdesc1->
constr != NULL)
484 for (
i = 0;
i < n;
i++)
491 if (strcmp(defval1->
adbin, defval2->
adbin) != 0)
498 for (
i = 0;
i < tupdesc1->
natts;
i++)
510 missatt1->attbyval, missatt1->attlen))
526 for (
i = 0;
i < n;
i++)
538 else if (tupdesc2->
constr != NULL)
585 const char *attributeName,
598 Assert(attributeNumber >= 1);
599 Assert(attributeNumber <= desc->natts);
615 if (attributeName == NULL)
617 else if (attributeName !=
NameStr(att->attname))
620 att->attstattarget = -1;
621 att->attcacheoff = -1;
622 att->atttypmod = typmod;
624 att->attnum = attributeNumber;
625 att->attndims = attdim;
627 att->attnotnull =
false;
628 att->atthasdef =
false;
629 att->atthasmissing =
false;
630 att->attidentity =
'\0';
631 att->attgenerated =
'\0';
632 att->attisdropped =
false;
633 att->attislocal =
true;
634 att->attinhcount = 0;
639 elog(
ERROR,
"cache lookup failed for type %u", oidtypeid);
642 att->atttypid = oidtypeid;
643 att->attlen = typeForm->typlen;
644 att->attbyval = typeForm->typbyval;
645 att->attalign = typeForm->typalign;
646 att->attstorage = typeForm->typstorage;
648 att->attcollation = typeForm->typcollation;
661 const char *attributeName,
670 Assert(attributeNumber >= 1);
671 Assert(attributeNumber <= desc->natts);
680 Assert(attributeName != NULL);
683 att->attstattarget = -1;
684 att->attcacheoff = -1;
685 att->atttypmod = typmod;
687 att->attnum = attributeNumber;
688 att->attndims = attdim;
690 att->attnotnull =
false;
691 att->atthasdef =
false;
692 att->atthasmissing =
false;
693 att->attidentity =
'\0';
694 att->attgenerated =
'\0';
695 att->attisdropped =
false;
696 att->attislocal =
true;
697 att->attinhcount = 0;
700 att->atttypid = oidtypeid;
712 att->attbyval =
false;
713 att->attalign = TYPALIGN_INT;
714 att->attstorage = TYPSTORAGE_EXTENDED;
716 att->attcollation = DEFAULT_COLLATION_OID;
721 att->attbyval =
true;
722 att->attalign = TYPALIGN_CHAR;
723 att->attstorage = TYPSTORAGE_PLAIN;
730 att->attbyval =
true;
731 att->attalign = TYPALIGN_INT;
732 att->attstorage = TYPSTORAGE_PLAIN;
740 att->attalign = TYPALIGN_DOUBLE;
741 att->attstorage = TYPSTORAGE_PLAIN;
748 att->attbyval =
true;
749 att->attalign = TYPALIGN_INT;
750 att->attstorage = TYPSTORAGE_PLAIN;
756 elog(
ERROR,
"unsupported type %u", oidtypeid);
775 Assert(attributeNumber >= 1);
776 Assert(attributeNumber <= desc->natts);
778 TupleDescAttr(desc, attributeNumber - 1)->attcollation = collationid;
808 has_not_null =
false;
836 errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
837 errmsg(
"too many array dimensions"));
841 (
errcode(ERRCODE_INVALID_TABLE_DEFINITION),
842 errmsg(
"column \"%s\" cannot be declared SETOF",
846 atttypid, atttypmod, attdim);
852 att->attstorage = entry->
storage;
870 constr->
check = NULL;
915 forfour(l1, names, l2,
types, l3, typmods, l4, collations)
945 if (attrdef[
i].adnum ==
attnum)
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
void aclcheck_error_type(AclResult aclerr, Oid typeOid)
#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)
elog(ERROR, "%s: %s", p2, msg)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
static Datum hash_uint32(uint32 k)
static uint32 hash_combine(uint32 a, uint32 b)
#define HeapTupleIsValid(tuple)
Assert(fmt[strlen(fmt) - 1] !='\n')
char * pstrdup(const char *in)
void pfree(void *pointer)
void * palloc0(Size size)
void namestrcpy(Name name, const char *str)
void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName, Oid *typeid_p, int32 *typmod_p)
Oid GetColumnDefCollation(ParseState *pstate, ColumnDef *coldef, Oid typeOid)
#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 ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
void * stringToNode(const char *str)
ResourceOwner CurrentResourceOwner
void ResourceOwnerForgetTupleDesc(ResourceOwner owner, TupleDesc tupdesc)
void ResourceOwnerRememberTupleDesc(ResourceOwner owner, TupleDesc tupdesc)
void ResourceOwnerEnlargeTupleDescs(ResourceOwner owner)
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)
TupleDesc BuildDescForRelation(const List *columns)
void FreeTupleDesc(TupleDesc tupdesc)
void IncrTupleDescRefCount(TupleDesc tupdesc)
TupleDesc CreateTemplateTupleDesc(int natts)
Node * TupleDescGetDefault(TupleDesc tupdesc, AttrNumber attnum)
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
void TupleDescInitBuiltinEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
uint32 hashTupleDesc(TupleDesc desc)
TupleDesc BuildDescFromLists(const List *names, const List *types, const List *typmods, const List *collations)
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)
#define TupleDescSize(src)
struct TupleDescData * TupleDesc
#define TupleDescAttr(tupdesc, i)