Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd03f331

Browse files
committed
Ensure locks are acquired on RLS-added relations
During fireRIRrules(), get_row_security_policies can add tosecurityQuals and withCheckOptions. Make sure to lock any relationsadded at that point and before firing RIR rules on those expressions.Back-patch to 9.5 where RLS was added.
1 parentaed688e commitd03f331

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

‎src/backend/rewrite/rewriteHandler.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,6 +1787,8 @@ fireRIRrules(Query *parsetree, List *activeRIRs, bool forUpdatePushedDown)
17871787
{
17881788
if (hasSubLinks)
17891789
{
1790+
acquireLocksOnSubLinks_contextcontext;
1791+
17901792
/*
17911793
* Recursively process the new quals, checking for infinite
17921794
* recursion.
@@ -1799,6 +1801,23 @@ fireRIRrules(Query *parsetree, List *activeRIRs, bool forUpdatePushedDown)
17991801

18001802
activeRIRs=lcons_oid(RelationGetRelid(rel),activeRIRs);
18011803

1804+
/*
1805+
* get_row_security_policies just passed back securityQuals
1806+
* and/or withCheckOptions, and there were SubLinks, make sure
1807+
* we lock any relations which are referenced.
1808+
*
1809+
* These locks would normally be acquired by the parser, but
1810+
* securityQuals and withCheckOptions are added post-parsing.
1811+
*/
1812+
context.for_execute= true;
1813+
(void)acquireLocksOnSubLinks((Node*)securityQuals,&context);
1814+
(void)acquireLocksOnSubLinks((Node*)withCheckOptions,
1815+
&context);
1816+
1817+
/*
1818+
* Now that we have the locks on anything added by
1819+
* get_row_security_policies, fire any RIR rules for them.
1820+
*/
18021821
expression_tree_walker((Node*)securityQuals,
18031822
fireRIRonSubLink, (void*)activeRIRs);
18041823

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp