static struct tuple* __exec_type_from_tgtlist(struct list *targetList, bool hasoid, bool skipjunk) { struct tuple* typeInfo; struct list_cell* l; int len; int cur_resno = 1; if (skipjunk) len = ExecCleanTargetListLength(targetList); else len = exec_tgtlist_len(targetList); typeInfo = create_template_tupdesc(len, hasoid); foreach(l, targetList) { tgt_entry_xp *tle = lfirst(l); if (skipjunk && tle->resjunk) continue; tupdesc_init_attr(typeInfo, cur_resno, tle->resname, expr_type((node_n*) tle->expr), expr_typmod((node_n*) tle->expr), 0); tupdesc_init_collation(typeInfo, cur_resno, expr_collation((node_n *) tle->expr)); cur_resno++; }
static TupleDesc ExecTypeFromTLInternal(List *targetList, bool hasoid, bool skipjunk) { TupleDesc typeInfo; ListCell *l; int len; int cur_resno = 1; if (skipjunk) len = ExecCleanTargetListLength(targetList); else len = ExecTargetListLength(targetList); typeInfo = CreateTemplateTupleDesc(len, hasoid); foreach(l, targetList) { TargetEntry *tle = lfirst(l); if (skipjunk && tle->resjunk) continue; TupleDescInitEntry(typeInfo, cur_resno++, tle->resname, exprType((Node *) tle->expr), exprTypmod((Node *) tle->expr), 0); }