mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +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:
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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))
|
||||
|
Reference in New Issue
Block a user