aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_clause.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-03-16 00:31:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-03-16 00:31:55 +0000
commit23160139617f6cb998604c7324da2175f7409db5 (patch)
treecdd877b18be4f800499f4240c76aaed7759e0a2f /src/backend/parser/parse_clause.c
parent5981b9d03e724a54f3eac706c27056d601954a7f (diff)
downloadpostgresql-23160139617f6cb998604c7324da2175f7409db5.tar.gz
postgresql-23160139617f6cb998604c7324da2175f7409db5.zip
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.
Diffstat (limited to 'src/backend/parser/parse_clause.c')
-rw-r--r--src/backend/parser/parse_clause.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index 4384a4eaab8..9bdb91b4744 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -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;
}