1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

Clean up representation of function RTEs for functions returning RECORD.

The original coding stored the raw parser output (ColumnDef and TypeName
nodes) which was ugly, bulky, and wrong because it failed to create any
dependency on the referenced datatype --- and in fact would not track type
renamings and suchlike.  Instead store a list of column type OIDs in the
RTE.

Also fix up general failure of recordDependencyOnExpr to do anything sane
about recording dependencies on datatypes.  While there are many cases where
there will be an indirect dependency (eg if an operator returns a datatype,
the dependency on the operator is enough), we do have to record the datatype
as a separate dependency in examples like CoerceToDomain.

initdb forced because of change of stored rules.
This commit is contained in:
Tom Lane
2006-03-16 00:31:55 +00:00
parent 5981b9d03e
commit 2316013961
13 changed files with 249 additions and 145 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.148 2006/03/14 22:48:20 tgl Exp $
* $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.149 2006/03/16 00:31:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -537,23 +537,27 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
}
/*
* If a coldeflist is supplied, ensure it defines a legal set of names (no
* duplicates) and datatypes (no pseudo-types, for instance).
* OK, build an RTE for the function.
*/
rte = addRangeTableEntryForFunction(pstate, funcname, funcexpr,
r, true);
/*
* If a coldeflist was supplied, ensure it defines a legal set of names
* (no duplicates) and datatypes (no pseudo-types, for instance).
* addRangeTableEntryForFunction looked up the type names but didn't
* check them further than that.
*/
if (r->coldeflist)
{
TupleDesc tupdesc;
tupdesc = BuildDescForRelation(r->coldeflist);
tupdesc = BuildDescFromLists(rte->eref->colnames,
rte->funccoltypes,
rte->funccoltypmods);
CheckAttributeNamesTypes(tupdesc, RELKIND_COMPOSITE_TYPE);
}
/*
* OK, build an RTE for the function.
*/
rte = addRangeTableEntryForFunction(pstate, funcname, funcexpr,
r, true);
return rte;
}