diff options
| author | Tom Lane | 2006-03-16 00:31:55 +0000 |
|---|---|---|
| committer | Tom Lane | 2006-03-16 00:31:55 +0000 |
| commit | 23160139617f6cb998604c7324da2175f7409db5 (patch) | |
| tree | cdd877b18be4f800499f4240c76aaed7759e0a2f /src/backend/nodes | |
| parent | 5981b9d03e724a54f3eac706c27056d601954a7f (diff) | |
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/nodes')
| -rw-r--r-- | src/backend/nodes/copyfuncs.c | 5 | ||||
| -rw-r--r-- | src/backend/nodes/equalfuncs.c | 5 | ||||
| -rw-r--r-- | src/backend/nodes/outfuncs.c | 7 | ||||
| -rw-r--r-- | src/backend/nodes/readfuncs.c | 45 |
4 files changed, 13 insertions, 49 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index b38efcdec8b..0a0e5f40b0b 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.330 2006/03/14 22:48:19 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.331 2006/03/16 00:31:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1355,7 +1355,8 @@ _copyRangeTblEntry(RangeTblEntry *from) COPY_SCALAR_FIELD(relid); COPY_NODE_FIELD(subquery); COPY_NODE_FIELD(funcexpr); - COPY_NODE_FIELD(coldeflist); + COPY_NODE_FIELD(funccoltypes); + COPY_NODE_FIELD(funccoltypmods); COPY_SCALAR_FIELD(jointype); COPY_NODE_FIELD(joinaliasvars); COPY_NODE_FIELD(alias); diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index 0275b01c28e..9696925c2f3 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -18,7 +18,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.266 2006/03/14 22:48:19 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.267 2006/03/16 00:31:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1730,7 +1730,8 @@ _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b) COMPARE_SCALAR_FIELD(relid); COMPARE_NODE_FIELD(subquery); COMPARE_NODE_FIELD(funcexpr); - COMPARE_NODE_FIELD(coldeflist); + COMPARE_NODE_FIELD(funccoltypes); + COMPARE_NODE_FIELD(funccoltypmods); COMPARE_SCALAR_FIELD(jointype); COMPARE_NODE_FIELD(joinaliasvars); COMPARE_NODE_FIELD(alias); diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index ef87fedbc21..70e48c071b3 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.270 2006/03/14 22:48:19 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.271 2006/03/16 00:31:54 tgl Exp $ * * NOTES * Every node type that can appear in stored rules' parsetrees *must* @@ -1450,7 +1450,7 @@ _outTypeName(StringInfo str, TypeName *node) WRITE_BOOL_FIELD(pct_type); WRITE_INT_FIELD(typmod); WRITE_NODE_FIELD(arrayBounds); - /* location is deliberately not stored */ + WRITE_INT_FIELD(location); } static void @@ -1580,7 +1580,8 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node) break; case RTE_FUNCTION: WRITE_NODE_FIELD(funcexpr); - WRITE_NODE_FIELD(coldeflist); + WRITE_NODE_FIELD(funccoltypes); + WRITE_NODE_FIELD(funccoltypmods); break; case RTE_JOIN: WRITE_ENUM_FIELD(jointype, JoinType); diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index c7490a9567c..4e762d3a2ec 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.186 2006/03/14 22:48:19 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.187 2006/03/16 00:31:55 tgl Exp $ * * NOTES * Path and Plan nodes do not have any readfuncs support, because we @@ -863,42 +863,6 @@ _readFromExpr(void) * Stuff from parsenodes.h. */ -static ColumnDef * -_readColumnDef(void) -{ - READ_LOCALS(ColumnDef); - - READ_STRING_FIELD(colname); - READ_NODE_FIELD(typename); - READ_INT_FIELD(inhcount); - READ_BOOL_FIELD(is_local); - READ_BOOL_FIELD(is_not_null); - READ_NODE_FIELD(raw_default); - READ_STRING_FIELD(cooked_default); - READ_NODE_FIELD(constraints); - READ_NODE_FIELD(support); - - READ_DONE(); -} - -static TypeName * -_readTypeName(void) -{ - READ_LOCALS(TypeName); - - READ_NODE_FIELD(names); - READ_OID_FIELD(typeid); - READ_BOOL_FIELD(timezone); - READ_BOOL_FIELD(setof); - READ_BOOL_FIELD(pct_type); - READ_INT_FIELD(typmod); - READ_NODE_FIELD(arrayBounds); - /* location is deliberately not stored */ - local_node->location = -1; - - READ_DONE(); -} - /* * _readRangeTblEntry */ @@ -923,7 +887,8 @@ _readRangeTblEntry(void) break; case RTE_FUNCTION: READ_NODE_FIELD(funcexpr); - READ_NODE_FIELD(coldeflist); + READ_NODE_FIELD(funccoltypes); + READ_NODE_FIELD(funccoltypmods); break; case RTE_JOIN: READ_ENUM_FIELD(jointype, JoinType); @@ -1042,10 +1007,6 @@ parseNodeString(void) return_value = _readJoinExpr(); else if (MATCH("FROMEXPR", 8)) return_value = _readFromExpr(); - else if (MATCH("COLUMNDEF", 9)) - return_value = _readColumnDef(); - else if (MATCH("TYPENAME", 8)) - return_value = _readTypeName(); else if (MATCH("RTE", 3)) return_value = _readRangeTblEntry(); else if (MATCH("NOTIFY", 6)) |
