Skip to main content

When I granted the user in schema and tables it is used by one day only

  • May 7, 2014
  • 2 replies
  • 6 views

Don_1
I have a question for granted the User, when I granted the user in schemas and tables it is used by one day, later and sooner it will be prompted permission denied to the user that I was granted, how it possible to unlimited used the schemas and tables? appreciate your feedback. Thank you.

2 replies

Don_1
  • Author
  • New Participant
  • May 8, 2014
Help me on this please.

Adrian_Oprea_1
Forum|alt.badge.img+1
  • Participating Frequently
  • May 9, 2014
If you drop that object in that period of time the grant will be lost !! 
See example : 

dbadmin=> grant select on rio_desc to test1;  GRANT PRIVILEGE  
dbadmin=> SELECT grantee, grantor, privileges_description, object_schema, object_name
dbadmin->    FROM grants WHERE grantee='test1';
 grantee | grantor | privileges_description | object_schema | object_name
---------+---------+------------------------+---------------+-------------
 test1   | dbadmin | USAGE                  |               | general
 test1   | dbadmin | SELECT                 | public        | rio_desc
(2 rows) -- see grants given
dbadmin=> SELECT grantee, grantor, privileges_description, object_schema, object_name
dbadmin->    FROM grants WHERE grantee='test1' and object_name='rio_desc' ;
 grantee | grantor | privileges_description | object_schema | object_name
---------+---------+------------------------+---------------+-------------
 test1   | dbadmin | SELECT                 | public        | rio_desc
(1 row) -- drop object
dbadmin=> drop view rio_desc ;
DROP VIEW
dbadmin=> SELECT grantee, grantor, privileges_description, object_schema, object_name
dbadmin->    FROM grants WHERE grantee='test1' and object_name='rio_desc' ;
 grantee | grantor | privileges_description | object_schema | object_name
---------+---------+------------------------+---------------+-------------
(0 rows) -- no role left
dbadmin=> create view rio_desc as select * from rio;
CREATE VIEW
dbadmin=> SELECT grantee, grantor, privileges_description, object_schema, object_name
dbadmin->    FROM grants WHERE grantee='test1' and object_name='rio_desc' ;
 grantee | grantor | privileges_description | object_schema | object_name
---------+---------+------------------------+---------------+-------------
(0 rows)
-- still no role even after you recreate the object.