1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-01 21:31:19 +03:00

Fix pull_up_simple_union_all to copy all rtable entries from child subquery to

parent, not only those with RangeTblRefs. We need them in ExecCheckRTPerms.

Report by Brendan O'Shea. Back-patch to 8.2, where pull_up_simple_union_all
was introduced.
This commit is contained in:
Heikki Linnakangas
2008-08-14 20:31:29 +00:00
parent e006a24ad1
commit f24f233f6a
3 changed files with 61 additions and 32 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.108 2008/08/14 18:47:59 tgl Exp $
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.109 2008/08/14 20:31:29 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -533,6 +533,25 @@ IncrementVarSublevelsUp(Node *node, int delta_sublevels_up,
0);
}
/*
* IncrementVarSublevelsUp_rtable -
* Same as IncrementVarSublevelsUp, but to be invoked on a range table.
*/
void
IncrementVarSublevelsUp_rtable(List *rtable, int delta_sublevels_up,
int min_sublevels_up)
{
IncrementVarSublevelsUp_context context;
context.delta_sublevels_up = delta_sublevels_up;
context.min_sublevels_up = min_sublevels_up;
range_table_walker(rtable,
IncrementVarSublevelsUp_walker,
(void *) &context,
0);
}
/*
* rangeTableEntry_used - detect whether an RTE is referenced somewhere