mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Turn the rangetable used by the executor into a flat list, and avoid storing
useless substructure for its RangeTblEntry nodes. (I chose to keep using the same struct node type and just zero out the link fields for unneeded info, rather than making a separate ExecRangeTblEntry type --- it seemed too fragile to have two different rangetable representations.) Along the way, put subplans into a list in the toplevel PlannedStmt node, and have SubPlan nodes refer to them by list index instead of direct pointers. Vadim wanted to do that years ago, but I never understood what he was on about until now. It makes things a *whole* lot more robust, because we can stop worrying about duplicate processing of subplans during expression tree traversals. That's been a constant source of bugs, and it's finally gone. There are some consequent simplifications yet to be made, like not using a separate EState for subplans in the executor, but I'll tackle that later.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.211 2007/02/11 22:18:15 petere Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.212 2007/02/22 22:00:25 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1769,12 +1769,7 @@ exprType(Node *expr)
|
||||
subplan->subLinkType == ARRAY_SUBLINK)
|
||||
{
|
||||
/* get the type of the subselect's first target column */
|
||||
TargetEntry *tent;
|
||||
|
||||
tent = (TargetEntry *) linitial(subplan->plan->targetlist);
|
||||
Assert(IsA(tent, TargetEntry));
|
||||
Assert(!tent->resjunk);
|
||||
type = exprType((Node *) tent->expr);
|
||||
type = subplan->firstColType;
|
||||
if (subplan->subLinkType == ARRAY_SUBLINK)
|
||||
{
|
||||
type = get_array_type(type);
|
||||
@ -1782,7 +1777,7 @@ exprType(Node *expr)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
errmsg("could not find array type for data type %s",
|
||||
format_type_be(exprType((Node *) tent->expr)))));
|
||||
format_type_be(subplan->firstColType))));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user