]> granicus.if.org Git - postgresql/commit
Improve RLS handling in copy.c
authorStephen Frost <sfrost@snowman.net>
Mon, 27 Jul 2015 20:48:26 +0000 (16:48 -0400)
committerStephen Frost <sfrost@snowman.net>
Mon, 27 Jul 2015 20:49:07 +0000 (16:49 -0400)
commit5d179a28fb4c819f3812c40fa7e626b1d3081982
tree6c7bbceaab2ddce591a2651c61b5ce0dc0f0b65f
parentcb0bb53204d84cecf51022313fe47d625de8f01e
Improve RLS handling in copy.c

To avoid a race condition where the relation being COPY'd could be
changed into a view or otherwise modified, keep the original lock
on the relation.  Further, fully qualify the relation when building
the query up.

Also remove the poorly thought-out Assert() and check the entire
relationOids list as, post-RLS, there can certainly be multiple
relations involved and the planner does not guarantee their ordering.

Per discussion with Noah and Andres.

Back-patch to 9.5 where RLS was introduced.
src/backend/commands/copy.c
src/test/regress/expected/rowsecurity.out
src/test/regress/sql/rowsecurity.sql