Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
d05b4bd7
Commit
d05b4bd7
authored
May 03, 2001
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Permission checking wasn't quite right for insert/update/delete rules,
either :-(.
parent
c434ae35
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteDefine.c
+12
-13
No files found.
src/backend/rewrite/rewriteDefine.c
View file @
d05b4bd7
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.6
1 2001/03/23 04:49:54 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.6
2 2001/05/03 21:16:48 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -377,7 +377,7 @@ DefineQueryRewrite(RuleStmt *stmt)
* We want the rule's table references to be checked as though by the
* rule owner, not the user referencing the rule. Therefore, scan
* through the rule's rtables and set the checkAsUser field on all
* rtable entries
(except *OLD* and *NEW*)
.
* rtable entries.
*/
foreach
(
l
,
action
)
{
...
...
@@ -426,29 +426,28 @@ DefineQueryRewrite(RuleStmt *stmt)
/*
* setRuleCheckAsUser
* Recursively scan a query and set the checkAsUser field to the
* given userid in all rtable entries except *OLD* and *NEW*.
* given userid in all rtable entries.
*
* Note: for a view (ON SELECT rule), the checkAsUser field of the *OLD*
* RTE entry will be overridden when the view rule is expanded, and the
* checkAsUser field of the *NEW* entry is irrelevant because that entry's
* checkFor bits will never be set. However, for other types of rules it's
* important to set these fields to match the rule owner. So we just set
* them always.
*/
static
void
setRuleCheckAsUser
(
Query
*
qry
,
Oid
userid
)
{
List
*
l
;
/* Set all the RTEs in this query node
, except OLD and NEW
*/
/* Set all the RTEs in this query node */
foreach
(
l
,
qry
->
rtable
)
{
RangeTblEntry
*
rte
=
(
RangeTblEntry
*
)
lfirst
(
l
);
if
(
strcmp
(
rte
->
eref
->
relname
,
"*NEW*"
)
==
0
)
continue
;
if
(
strcmp
(
rte
->
eref
->
relname
,
"*OLD*"
)
==
0
)
continue
;
if
(
rte
->
subquery
)
{
/*
* Recurse into subquery in FROM
*/
/* Recurse into subquery in FROM */
setRuleCheckAsUser
(
rte
->
subquery
,
userid
);
}
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment