| 1970 | } |
| 1971 | |
| 1972 | static TupleDesc |
| 1973 | ExecTypeFromTLInternal(List *targetList, bool skipjunk) |
| 1974 | { |
| 1975 | TupleDesc typeInfo; |
| 1976 | ListCell *l; |
| 1977 | int len; |
| 1978 | int cur_resno = 1; |
| 1979 | |
| 1980 | if (skipjunk) |
| 1981 | len = ExecCleanTargetListLength(targetList); |
| 1982 | else |
| 1983 | len = ExecTargetListLength(targetList); |
| 1984 | typeInfo = CreateTemplateTupleDesc(len); |
| 1985 | |
| 1986 | foreach(l, targetList) |
| 1987 | { |
| 1988 | TargetEntry *tle = lfirst(l); |
| 1989 | |
| 1990 | if (skipjunk && tle->resjunk) |
| 1991 | continue; |
| 1992 | TupleDescInitEntry(typeInfo, |
| 1993 | cur_resno, |
| 1994 | tle->resname, |
| 1995 | exprType((Node *) tle->expr), |
| 1996 | exprTypmod((Node *) tle->expr), |
| 1997 | 0); |
| 1998 | TupleDescInitEntryCollation(typeInfo, |
| 1999 | cur_resno, |
| 2000 | exprCollation((Node *) tle->expr)); |
| 2001 | cur_resno++; |
| 2002 | } |
| 2003 | |
| 2004 | return typeInfo; |
| 2005 | } |
| 2006 | |
| 2007 | /* |
| 2008 | * ExecTypeFromExprList - build a tuple descriptor from a list of Exprs |
no test coverage detected