mirror of https://github.com/postgres/postgres
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:
parent
f02a82b6ad
commit
b396df8485
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* In the flat rangetable, we zero out substructure pointers that are
|
||||||
* not needed by the executor; this reduces the storage space and
|
* 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)
|
foreach(lc, rtable)
|
||||||
{
|
{
|
||||||
|
@ -167,14 +168,13 @@ set_plan_references(PlannerGlobal *glob, Plan *plan, List *rtable)
|
||||||
newrte = (RangeTblEntry *) palloc(sizeof(RangeTblEntry));
|
newrte = (RangeTblEntry *) palloc(sizeof(RangeTblEntry));
|
||||||
memcpy(newrte, rte, 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->subquery = NULL;
|
||||||
newrte->funcexpr = NULL;
|
newrte->funcexpr = NULL;
|
||||||
newrte->funccoltypes = NIL;
|
newrte->funccoltypes = NIL;
|
||||||
newrte->funccoltypmods = NIL;
|
newrte->funccoltypmods = NIL;
|
||||||
newrte->values_lists = NIL;
|
newrte->values_lists = NIL;
|
||||||
newrte->joinaliasvars = NIL;
|
newrte->joinaliasvars = NIL;
|
||||||
newrte->alias = NULL;
|
|
||||||
|
|
||||||
glob->finalrtable = lappend(glob->finalrtable, newrte);
|
glob->finalrtable = lappend(glob->finalrtable, newrte);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue