pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix incorrect varlevelsup in security_barrier_replace_vars(). 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix incorrect varlevelsup in security_barrier_replace_vars(). @ 2016-02-29 12:42 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 3+ messages in thread From: Dean Rasheed @ 2016-02-29 12:42 UTC (permalink / raw) To: pgsql-committers Fix incorrect varlevelsup in security_barrier_replace_vars(). When converting an RTE with securityQuals into a security barrier subquery RTE, ensure that the Vars in the new subquery's targetlist all have varlevelsup = 0 so that they correctly refer to the underlying base relation being wrapped. The original code was creating new Vars by copying them from existing Vars referencing the base relation found elsewhere in the query, but failed to account for the fact that such Vars could come from sublink subqueries, and hence have varlevelsup > 0. In practice it looks like this could only happen with nested security barrier views, where the outer view has a WHERE clause containing a correlated subquery, due to the order in which the Vars are processed. Bug: #13988 Reported-by: Adam Guthrie Backpatch-to: 9.4, where updatable SB views were introduced Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/9b69d5c1daeb62804eeaeab2f804191dbe0a943d Modified Files -------------- src/backend/optimizer/prep/prepsecurity.c | 1 + src/test/regress/expected/updatable_views.out | 39 +++++++++++++++++++++++++++ src/test/regress/sql/updatable_views.sql | 34 +++++++++++++++++++++++ 3 files changed, 74 insertions(+) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix incorrect varlevelsup in security_barrier_replace_vars(). @ 2016-02-29 12:42 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 3+ messages in thread From: Dean Rasheed @ 2016-02-29 12:42 UTC (permalink / raw) To: pgsql-committers Fix incorrect varlevelsup in security_barrier_replace_vars(). When converting an RTE with securityQuals into a security barrier subquery RTE, ensure that the Vars in the new subquery's targetlist all have varlevelsup = 0 so that they correctly refer to the underlying base relation being wrapped. The original code was creating new Vars by copying them from existing Vars referencing the base relation found elsewhere in the query, but failed to account for the fact that such Vars could come from sublink subqueries, and hence have varlevelsup > 0. In practice it looks like this could only happen with nested security barrier views, where the outer view has a WHERE clause containing a correlated subquery, due to the order in which the Vars are processed. Bug: #13988 Reported-by: Adam Guthrie Backpatch-to: 9.4, where updatable SB views were introduced Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/41fedc24626696fdf55d0c43131d91757dbe1c66 Modified Files -------------- src/backend/optimizer/prep/prepsecurity.c | 1 + src/test/regress/expected/updatable_views.out | 39 +++++++++++++++++++++++++++ src/test/regress/sql/updatable_views.sql | 34 +++++++++++++++++++++++ 3 files changed, 74 insertions(+) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix incorrect varlevelsup in security_barrier_replace_vars(). @ 2016-02-29 12:42 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 3+ messages in thread From: Dean Rasheed @ 2016-02-29 12:42 UTC (permalink / raw) To: pgsql-committers Fix incorrect varlevelsup in security_barrier_replace_vars(). When converting an RTE with securityQuals into a security barrier subquery RTE, ensure that the Vars in the new subquery's targetlist all have varlevelsup = 0 so that they correctly refer to the underlying base relation being wrapped. The original code was creating new Vars by copying them from existing Vars referencing the base relation found elsewhere in the query, but failed to account for the fact that such Vars could come from sublink subqueries, and hence have varlevelsup > 0. In practice it looks like this could only happen with nested security barrier views, where the outer view has a WHERE clause containing a correlated subquery, due to the order in which the Vars are processed. Bug: #13988 Reported-by: Adam Guthrie Backpatch-to: 9.4, where updatable SB views were introduced Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/f1dfcf63d9f076d9c200c0d7ee670899149e302a Modified Files -------------- src/backend/optimizer/prep/prepsecurity.c | 1 + src/test/regress/expected/updatable_views.out | 39 +++++++++++++++++++++++++++ src/test/regress/sql/updatable_views.sql | 34 +++++++++++++++++++++++ 3 files changed, 74 insertions(+) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2016-02-29 12:42 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-02-29 12:42 pgsql: Fix incorrect varlevelsup in security_barrier_replace_vars(). Dean Rasheed <dean.a.rasheed@gmail.com> 2016-02-29 12:42 pgsql: Fix incorrect varlevelsup in security_barrier_replace_vars(). Dean Rasheed <dean.a.rasheed@gmail.com> 2016-02-29 12:42 pgsql: Fix incorrect varlevelsup in security_barrier_replace_vars(). Dean Rasheed <dean.a.rasheed@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox