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
a5f7d581
Commit
a5f7d581
authored
Oct 22, 2014
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for sequence privileges
parent
69fed5b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
321 additions
and
0 deletions
+321
-0
src/test/regress/expected/sequence.out
src/test/regress/expected/sequence.out
+123
-0
src/test/regress/expected/sequence_1.out
src/test/regress/expected/sequence_1.out
+123
-0
src/test/regress/sql/sequence.sql
src/test/regress/sql/sequence.sql
+75
-0
No files found.
src/test/regress/expected/sequence.out
View file @
a5f7d581
...
...
@@ -367,6 +367,41 @@ DROP SEQUENCE seq2;
SELECT lastval();
ERROR: lastval is not yet defined in this session
CREATE USER seq_user;
-- privileges tests
-- nextval
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
REVOKE ALL ON seq3 FROM seq_user;
GRANT SELECT ON seq3 TO seq_user;
SELECT nextval('seq3');
ERROR: permission denied for sequence seq3
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
REVOKE ALL ON seq3 FROM seq_user;
GRANT UPDATE ON seq3 TO seq_user;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
REVOKE ALL ON seq3 FROM seq_user;
GRANT USAGE ON seq3 TO seq_user;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
ROLLBACK;
-- currval
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
...
...
@@ -377,8 +412,96 @@ SELECT nextval('seq3');
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT SELECT ON seq3 TO seq_user;
SELECT currval('seq3');
currval
---------
1
(1
row)
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT UPDATE ON seq3 TO seq_user;
SELECT currval('seq3');
ERROR: permission denied for sequence seq3
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT USAGE ON seq3 TO seq_user;
SELECT currval('seq3');
currval
---------
1
(1
row)
ROLLBACK;
-- lastval
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT SELECT ON seq3 TO seq_user;
SELECT lastval();
lastval
---------
1
(1
row)
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT UPDATE ON seq3 TO seq_user;
SELECT lastval();
ERROR: permission denied for sequence seq3
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT USAGE ON seq3 TO seq_user;
SELECT lastval();
lastval
---------
1
(1
row)
ROLLBACK;
-- Sequences should get wiped out as well:
DROP TABLE serialTest, serialTest2;
...
...
src/test/regress/expected/sequence_1.out
View file @
a5f7d581
...
...
@@ -367,6 +367,41 @@ DROP SEQUENCE seq2;
SELECT lastval();
ERROR: lastval is not yet defined in this session
CREATE USER seq_user;
-- privileges tests
-- nextval
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
REVOKE ALL ON seq3 FROM seq_user;
GRANT SELECT ON seq3 TO seq_user;
SELECT nextval('seq3');
ERROR: permission denied for sequence seq3
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
REVOKE ALL ON seq3 FROM seq_user;
GRANT UPDATE ON seq3 TO seq_user;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
REVOKE ALL ON seq3 FROM seq_user;
GRANT USAGE ON seq3 TO seq_user;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
ROLLBACK;
-- currval
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
...
...
@@ -377,8 +412,96 @@ SELECT nextval('seq3');
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT SELECT ON seq3 TO seq_user;
SELECT currval('seq3');
currval
---------
1
(1
row)
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT UPDATE ON seq3 TO seq_user;
SELECT currval('seq3');
ERROR: permission denied for sequence seq3
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT USAGE ON seq3 TO seq_user;
SELECT currval('seq3');
currval
---------
1
(1
row)
ROLLBACK;
-- lastval
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT SELECT ON seq3 TO seq_user;
SELECT lastval();
lastval
---------
1
(1
row)
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT UPDATE ON seq3 TO seq_user;
SELECT lastval();
ERROR: permission denied for sequence seq3
ROLLBACK;
BEGIN;
SET LOCAL SESSION AUTHORIZATION seq_user;
CREATE SEQUENCE seq3;
SELECT nextval('seq3');
nextval
---------
1
(1
row)
REVOKE ALL ON seq3 FROM seq_user;
GRANT USAGE ON seq3 TO seq_user;
SELECT lastval();
lastval
---------
1
(1
row)
ROLLBACK;
-- Sequences should get wiped out as well:
DROP TABLE serialTest, serialTest2;
...
...
src/test/regress/sql/sequence.sql
View file @
a5f7d581
...
...
@@ -168,11 +168,86 @@ SELECT lastval();
CREATE
USER
seq_user
;
-- privileges tests
-- nextval
BEGIN
;
SET
LOCAL
SESSION
AUTHORIZATION
seq_user
;
CREATE
SEQUENCE
seq3
;
REVOKE
ALL
ON
seq3
FROM
seq_user
;
GRANT
SELECT
ON
seq3
TO
seq_user
;
SELECT
nextval
(
'seq3'
);
ROLLBACK
;
BEGIN
;
SET
LOCAL
SESSION
AUTHORIZATION
seq_user
;
CREATE
SEQUENCE
seq3
;
REVOKE
ALL
ON
seq3
FROM
seq_user
;
GRANT
UPDATE
ON
seq3
TO
seq_user
;
SELECT
nextval
(
'seq3'
);
ROLLBACK
;
BEGIN
;
SET
LOCAL
SESSION
AUTHORIZATION
seq_user
;
CREATE
SEQUENCE
seq3
;
REVOKE
ALL
ON
seq3
FROM
seq_user
;
GRANT
USAGE
ON
seq3
TO
seq_user
;
SELECT
nextval
(
'seq3'
);
ROLLBACK
;
-- currval
BEGIN
;
SET
LOCAL
SESSION
AUTHORIZATION
seq_user
;
CREATE
SEQUENCE
seq3
;
SELECT
nextval
(
'seq3'
);
REVOKE
ALL
ON
seq3
FROM
seq_user
;
GRANT
SELECT
ON
seq3
TO
seq_user
;
SELECT
currval
(
'seq3'
);
ROLLBACK
;
BEGIN
;
SET
LOCAL
SESSION
AUTHORIZATION
seq_user
;
CREATE
SEQUENCE
seq3
;
SELECT
nextval
(
'seq3'
);
REVOKE
ALL
ON
seq3
FROM
seq_user
;
GRANT
UPDATE
ON
seq3
TO
seq_user
;
SELECT
currval
(
'seq3'
);
ROLLBACK
;
BEGIN
;
SET
LOCAL
SESSION
AUTHORIZATION
seq_user
;
CREATE
SEQUENCE
seq3
;
SELECT
nextval
(
'seq3'
);
REVOKE
ALL
ON
seq3
FROM
seq_user
;
GRANT
USAGE
ON
seq3
TO
seq_user
;
SELECT
currval
(
'seq3'
);
ROLLBACK
;
-- lastval
BEGIN
;
SET
LOCAL
SESSION
AUTHORIZATION
seq_user
;
CREATE
SEQUENCE
seq3
;
SELECT
nextval
(
'seq3'
);
REVOKE
ALL
ON
seq3
FROM
seq_user
;
GRANT
SELECT
ON
seq3
TO
seq_user
;
SELECT
lastval
();
ROLLBACK
;
BEGIN
;
SET
LOCAL
SESSION
AUTHORIZATION
seq_user
;
CREATE
SEQUENCE
seq3
;
SELECT
nextval
(
'seq3'
);
REVOKE
ALL
ON
seq3
FROM
seq_user
;
GRANT
UPDATE
ON
seq3
TO
seq_user
;
SELECT
lastval
();
ROLLBACK
;
BEGIN
;
SET
LOCAL
SESSION
AUTHORIZATION
seq_user
;
CREATE
SEQUENCE
seq3
;
SELECT
nextval
(
'seq3'
);
REVOKE
ALL
ON
seq3
FROM
seq_user
;
GRANT
USAGE
ON
seq3
TO
seq_user
;
SELECT
lastval
();
ROLLBACK
;
...
...
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