설문조사
PostgreSQL/PPAS 관련 듣고 싶은 교육은


총 게시물 162건, 최근 0 건
   

User별 테이블 권한 보기

글쓴이 : 주킹 날짜 : 2015-01-08 (목) 10:50 조회 : 20961
User별 권한을 보기에 유용한 View인
 
 information_schema.role_table_grants에 대해 알려드립니다.
 
king=# select * from information_schema.role_table_grants limit 10;
 
   grantor    |   grantee    | table_catalog | table_schema |  table_name  | pri
vilege_type | is_grantable | with_hierarchy
--------------+--------------+---------------+--------------+--------------+----
------------+--------------+----------------
 enterprisedb | enterprisedb | king          | pg_catalog   | pg_statistic | INS
ERT         | YES          | NO
 enterprisedb | enterprisedb | king          | pg_catalog   | pg_statistic | SEL
ECT         | YES          | YES
 enterprisedb | enterprisedb | king          | pg_catalog   | pg_statistic | UPD
ATE         | YES          | NO
 enterprisedb | enterprisedb | king          | pg_catalog   | pg_statistic | DEL
ETE         | YES          | NO
 enterprisedb | enterprisedb | king          | pg_catalog   | pg_statistic | TRU
NCATE       | YES          | NO
 enterprisedb | enterprisedb | king          | pg_catalog   | pg_statistic | REF
ERENCES     | YES          | NO
 enterprisedb | enterprisedb | king          | pg_catalog   | pg_statistic | TRI
GGER        | YES          | NO
 enterprisedb | PUBLIC       | king          | pg_catalog   | pg_type      | SEL
ECT         | NO           | YES
 enterprisedb | enterprisedb | king          | public       | wow          | INS
ERT         | YES          | NO
 enterprisedb | enterprisedb | king          | public       | wow          | SEL
ECT         | YES          | YES
(10 rows)
 
위와 같이 조회하면 현재 접속해 있는 User와 Database의 권한을 참고하여
 
아래와 같은 정보를 얻을 수 있습니다.
 
 ØGrantor :  권한을 부여한 role
ØGrantee :  권한을 부여받은 role
ØTable_schema : schema
ØTable_name : table
ØPrivilege_type : 권한의 유형
ØIs_grantable :  권한을 줄 수 있을 경우 YES, 아닐 경우 NO
 
만약 접속한 User가 해당  Schema 조회 권한이 없을 경우에는
 
king=# \c king king
You are now connected to database "king" as user "king".
king=> select * from information_schema.role_table_grants limit 10;
 grantor | grantee | table_catalog | table_schema | table_name | privilege_type
| is_grantable | with_hierarchy
---------+---------+---------------+--------------+------------+----------------
+--------------+----------------
(0 rows)
 
위와 같이 조회가 되지 않습니다.
 
그 밖에도 information_schema에는 유용한 view가 많으니 참조하시길 바랍니다^^
 

   

postgresdba.com