Skip to content

Commit b396df8

Browse files
committed
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.
1 parent f02a82b commit b396df8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backend/optimizer/plan/setrefs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.133 2007/02/23 21:59:44 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.134 2007/04/06 22:57:20 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -156,7 +156,8 @@ set_plan_references(PlannerGlobal *glob, Plan *plan, List *rtable)
156156
/*
157157
* In the flat rangetable, we zero out substructure pointers that are
158158
* not needed by the executor; this reduces the storage space and
159-
* copying cost for cached plans.
159+
* copying cost for cached plans. We keep only the alias and eref
160+
* Alias fields, which are needed by EXPLAIN.
160161
*/
161162
foreach(lc, rtable)
162163
{
@@ -167,14 +168,13 @@ set_plan_references(PlannerGlobal *glob, Plan *plan, List *rtable)
167168
newrte = (RangeTblEntry *) palloc(sizeof(RangeTblEntry));
168169
memcpy(newrte, rte, sizeof(RangeTblEntry));
169170

170-
/* zap unneeded sub-structure (we keep only the eref Alias) */
171+
/* zap unneeded sub-structure */
171172
newrte->subquery = NULL;
172173
newrte->funcexpr = NULL;
173174
newrte->funccoltypes = NIL;
174175
newrte->funccoltypmods = NIL;
175176
newrte->values_lists = NIL;
176177
newrte->joinaliasvars = NIL;
177-
newrte->alias = NULL;
178178

179179
glob->finalrtable = lappend(glob->finalrtable, newrte);
180180
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy