95 nincols = noutcols = 0;
97 for (
i = 0;
i < n;
i++)
101 if (outatt->attisdropped)
108 if (inatt->attisdropped)
113 if (outatt->atttypid != inatt->atttypid ||
114 (outatt->atttypmod != inatt->atttypmod && outatt->atttypmod >= 0))
116 (
errcode(ERRCODE_DATATYPE_MISMATCH),
118 errdetail(
"Returned type %s does not match expected type %s in column \"%s\" (position %d).",
145 (
errcode(ERRCODE_DATATYPE_MISMATCH),
147 errdetail(
"Number of returned columns (%d) does not match "
148 "expected column count (%d).",
149 nincols, noutcols)));
185 outnatts = outdesc->
natts;
186 innatts = indesc->
natts;
189 for (
i = 0;
i < outnatts;
i++)
197 if (outatt->attisdropped)
200 atttypid = outatt->atttypid;
201 atttypmod = outatt->atttypmod;
214 for (
j = 0;
j < innatts;
j++)
219 if (nextindesc >= innatts)
223 if (inatt->attisdropped)
228 if (atttypid != inatt->atttypid || atttypmod != inatt->atttypmod)
230 (
errcode(ERRCODE_DATATYPE_MISMATCH),
231 errmsg(
"could not convert row type"),
232 errdetail(
"Attribute \"%s\" of type %s does not match corresponding attribute of type %s.",
236 attrMap->
attnums[
i] = inatt->attnum;
240 if (attrMap->
attnums[
i] == 0 && !missing_ok)
242 (
errcode(ERRCODE_DATATYPE_MISMATCH),
243 errmsg(
"could not convert row type"),
244 errdetail(
"Attribute \"%s\" of type %s does not exist in type %s.",
void free_attrmap(AttrMap *map)
AttrMap * make_attrmap(int maplen)
AttrMap * build_attrmap_by_name(TupleDesc indesc, TupleDesc outdesc, bool missing_ok)
AttrMap * build_attrmap_by_name_if_req(TupleDesc indesc, TupleDesc outdesc, bool missing_ok)
static bool check_attrmap_match(TupleDesc indesc, TupleDesc outdesc, AttrMap *attrMap)
AttrMap * build_attrmap_by_position(TupleDesc indesc, TupleDesc outdesc, const char *msg)
int errmsg_internal(const char *fmt,...)
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void pfree(void *pointer)
void * palloc0(Size size)
FormData_pg_attribute * Form_pg_attribute
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)