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

Commit13cd9eb

Browse files
committed
Remove bitrotten view_perms test. Add some similar test cases to
privileges test.
1 parentc88540f commit13cd9eb

File tree

4 files changed

+48
-222
lines changed

4 files changed

+48
-222
lines changed

‎src/test/regress/expected/privileges.out

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ SELECT * FROM atestv1; -- ok
174174
1 | two
175175
(2 rows)
176176

177+
SELECT * FROM atestv2; -- fail
178+
ERROR: atest2: permission denied
177179
GRANT SELECT ON atestv1, atestv3 TO regressuser4;
180+
GRANT SELECT ON atestv2 TO regressuser2;
178181
SET SESSION AUTHORIZATION regressuser4;
179182
SELECT * FROM atestv1; -- ok
180183
a | b
@@ -183,11 +186,37 @@ SELECT * FROM atestv1; -- ok
183186
1 | two
184187
(2 rows)
185188

189+
SELECT * FROM atestv2; -- fail
190+
ERROR: atestv2: permission denied
186191
SELECT * FROM atestv3; -- ok
187192
one | two | three
188193
-----+-----+-------
189194
(0 rows)
190195

196+
CREATE VIEW atestv4 AS SELECT * FROM atestv3; -- nested view
197+
SELECT * FROM atestv4; -- ok
198+
one | two | three
199+
-----+-----+-------
200+
(0 rows)
201+
202+
GRANT SELECT ON atestv4 TO regressuser2;
203+
SET SESSION AUTHORIZATION regressuser2;
204+
-- Two complex cases:
205+
SELECT * FROM atestv3; -- fail
206+
ERROR: atestv3: permission denied
207+
SELECT * FROM atestv4; -- ok (even though regressuser2 cannot access underlying atestv3)
208+
one | two | three
209+
-----+-----+-------
210+
(0 rows)
211+
212+
SELECT * FROM atest2; -- ok
213+
col1 | col2
214+
------+------
215+
bar | t
216+
(1 row)
217+
218+
SELECT * FROM atestv2; -- fail (even though regressuser2 can access underlying atest2)
219+
ERROR: atest2: permission denied
191220
-- privileges on functions, languages
192221
-- switch to superuser
193222
\c -
@@ -521,6 +550,7 @@ DROP TABLE atest3;
521550
DROP VIEW atestv1;
522551
DROP VIEW atestv2;
523552
DROP VIEW atestv3;
553+
DROP VIEW atestv4;
524554
DROP GROUP regressgroup1;
525555
DROP GROUP regressgroup2;
526556
DROP USER regressuser1;

‎src/test/regress/expected/view_perms.out

Lines changed: 0 additions & 101 deletions
This file was deleted.

‎src/test/regress/sql/privileges.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,30 @@ CREATE VIEW atestv2 AS SELECT * FROM atest2;
118118
CREATEVIEWatestv3ASSELECT*FROM atest3;-- ok
119119

120120
SELECT*FROM atestv1;-- ok
121+
SELECT*FROM atestv2;-- fail
121122
GRANTSELECTON atestv1, atestv3 TO regressuser4;
123+
GRANTSELECTON atestv2 TO regressuser2;
122124

123125
SET SESSION AUTHORIZATION regressuser4;
124126

125127
SELECT*FROM atestv1;-- ok
128+
SELECT*FROM atestv2;-- fail
126129
SELECT*FROM atestv3;-- ok
127130

131+
CREATEVIEWatestv4ASSELECT*FROM atestv3;-- nested view
132+
SELECT*FROM atestv4;-- ok
133+
GRANTSELECTON atestv4 TO regressuser2;
134+
135+
SET SESSION AUTHORIZATION regressuser2;
136+
137+
-- Two complex cases:
138+
139+
SELECT*FROM atestv3;-- fail
140+
SELECT*FROM atestv4;-- ok (even though regressuser2 cannot access underlying atestv3)
141+
142+
SELECT*FROM atest2;-- ok
143+
SELECT*FROM atestv2;-- fail (even though regressuser2 can access underlying atest2)
144+
128145

129146
-- privileges on functions, languages
130147

@@ -282,6 +299,7 @@ DROP TABLE atest3;
282299
DROPVIEW atestv1;
283300
DROPVIEW atestv2;
284301
DROPVIEW atestv3;
302+
DROPVIEW atestv4;
285303

286304
DROPGROUP regressgroup1;
287305
DROPGROUP regressgroup2;

‎src/test/regress/sql/view_perms.sql

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp