Don't remove the 'alias' field from flattened rangetable entries;

there are some corner cases where this is needed by ruleutils.c for
proper display of variables during EXPLAIN.
This commit is contained in:
Tom Lane 2007-04-06 22:57:20 +00:00
parent f02a82b6ad
commit b396df8485
1 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.133 2007/02/23 21:59:44 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.134 2007/04/06 22:57:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -156,7 +156,8 @@ set_plan_references(PlannerGlobal *glob, Plan *plan, List *rtable)
/*
* In the flat rangetable, we zero out substructure pointers that are
* not needed by the executor; this reduces the storage space and
* copying cost for cached plans.
* copying cost for cached plans. We keep only the alias and eref
* Alias fields, which are needed by EXPLAIN.
*/
foreach(lc, rtable)
{
@ -167,14 +168,13 @@ set_plan_references(PlannerGlobal *glob, Plan *plan, List *rtable)
newrte = (RangeTblEntry *) palloc(sizeof(RangeTblEntry));
memcpy(newrte, rte, sizeof(RangeTblEntry));
/* zap unneeded sub-structure (we keep only the eref Alias) */
/* zap unneeded sub-structure */
newrte->subquery = NULL;
newrte->funcexpr = NULL;
newrte->funccoltypes = NIL;
newrte->funccoltypmods = NIL;
newrte->values_lists = NIL;
newrte->joinaliasvars = NIL;
newrte->alias = NULL;
glob->finalrtable = lappend(glob->finalrtable, newrte);
}