diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-07-21 20:03:58 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-07-21 20:03:58 -0400 |
commit | b6e7780346bae5fe07bd4631d355e692e1a8d006 (patch) | |
tree | a93df9ade47bb73a9832dfa728a3196c6a15ade3 /src | |
parent | 49c30004073fdb90800054cd1d13e5ab441f6283 (diff) | |
download | postgresql-b6e7780346bae5fe07bd4631d355e692e1a8d006.tar.gz postgresql-b6e7780346bae5fe07bd4631d355e692e1a8d006.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/optimizer/plan/setrefs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c index 32c3108cabd..c80e8a0007f 100644 --- a/src/backend/optimizer/plan/setrefs.c +++ b/src/backend/optimizer/plan/setrefs.c @@ -365,10 +365,10 @@ flatten_rtes_walker(Node *node, PlannerGlobal *glob) * * 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. We keep only the alias and eref Alias fields, which - * are needed by EXPLAIN, and the selectedCols and modifiedCols bitmaps, - * which are needed for executor-startup permissions checking and for - * trigger event checking. + * for cached plans. We keep only the ctename, alias and eref Alias fields, + * which are needed by EXPLAIN, and the selectedCols and modifiedCols bitmaps, + * which are needed for executor-startup permissions checking and for trigger + * event checking. */ static void add_rte_to_flat_rtable(PlannerGlobal *glob, RangeTblEntry *rte) @@ -388,6 +388,7 @@ add_rte_to_flat_rtable(PlannerGlobal *glob, RangeTblEntry *rte) newrte->ctecoltypes = NIL; newrte->ctecoltypmods = NIL; newrte->ctecolcollations = NIL; + newrte->securityQuals = NIL; glob->finalrtable = lappend(glob->finalrtable, newrte); |