Skip to content

Commit b6e7780

Browse files
committed
Fix add_rte_to_flat_rtable() for recent feature additions.
The TABLESAMPLE and row security patches each overlooked this function, though their errors of omission were opposite: RLS failed to zero out the securityQuals field, leading to wasteful copying of useless expression trees in finished plans, while TABLESAMPLE neglected to add a comment saying that it intentionally *isn't* deleting the tablesample subtree. There probably should be a similar comment about ctename, too. Back-patch as appropriate.
1 parent 49c3000 commit b6e7780

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/backend/optimizer/plan/setrefs.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,10 @@ flatten_rtes_walker(Node *node, PlannerGlobal *glob)
365365
*
366366
* In the flat rangetable, we zero out substructure pointers that are not
367367
* needed by the executor; this reduces the storage space and copying cost
368-
* for cached plans. We keep only the alias and eref Alias fields, which
369-
* are needed by EXPLAIN, and the selectedCols and modifiedCols bitmaps,
370-
* which are needed for executor-startup permissions checking and for
371-
* trigger event checking.
368+
* for cached plans. We keep only the ctename, alias and eref Alias fields,
369+
* which are needed by EXPLAIN, and the selectedCols and modifiedCols bitmaps,
370+
* which are needed for executor-startup permissions checking and for trigger
371+
* event checking.
372372
*/
373373
static void
374374
add_rte_to_flat_rtable(PlannerGlobal *glob, RangeTblEntry *rte)
@@ -388,6 +388,7 @@ add_rte_to_flat_rtable(PlannerGlobal *glob, RangeTblEntry *rte)
388388
newrte->ctecoltypes = NIL;
389389
newrte->ctecoltypmods = NIL;
390390
newrte->ctecolcollations = NIL;
391+
newrte->securityQuals = NIL;
391392

392393
glob->finalrtable = lappend(glob->finalrtable, newrte);
393394

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