1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-12 02:37:31 +03:00

Please find a attached a small patch that adds accessor functions

for "aclitem" so that it is not an opaque datatype.

I needed these functions to browse aclitems from user land. I can load
them when necessary, but it seems to me that these accessors for a
backend type belong to the backend, so I submit them.

Fabien Coelho
This commit is contained in:
Bruce Momjian
2004-04-26 15:06:49 +00:00
parent 9cb7b76ec7
commit 0a17fd726c
6 changed files with 82 additions and 5 deletions

View File

@@ -581,6 +581,20 @@ SELECT has_table_privilege('regressuser1', 'atest4', 'SELECT WITH GRANT OPTION')
t
(1 row)
-- aclitem utils small test
SELECT u1.usename AS u1, u2.usename AS u2,
aclitem_idtype(c.relacl[0]) AS idtype,
aclitem_privs(c.relacl[0]) AS privs,
aclitem_goptions(c.relacl[0]) AS goptions
FROM pg_class AS c, pg_user AS u1, pg_user AS u2
WHERE u1.usesysid = aclitem_grantor(c.relacl[0])
AND u2.usesysid = aclitem_grantee(c.relacl[0])
AND c.relname LIKE 'atest4';
u1 | u2 | idtype | privs | goptions
--------------+--------------+--------+-------+----------
regressuser1 | regressuser1 | 1 | 127 | 127
(1 row)
-- clean up
\c regression
DROP FUNCTION testfunc2(int);

View File

@@ -316,6 +316,15 @@ SELECT has_table_privilege('regressuser3', 'atest4', 'SELECT'); -- false
SELECT has_table_privilege('regressuser1', 'atest4', 'SELECT WITH GRANT OPTION'); -- true
-- aclitem utils small test
SELECT u1.usename AS u1, u2.usename AS u2,
aclitem_idtype(c.relacl[0]) AS idtype,
aclitem_privs(c.relacl[0]) AS privs,
aclitem_goptions(c.relacl[0]) AS goptions
FROM pg_class AS c, pg_user AS u1, pg_user AS u2
WHERE u1.usesysid = aclitem_grantor(c.relacl[0])
AND u2.usesysid = aclitem_grantee(c.relacl[0])
AND c.relname LIKE 'atest4';
-- clean up