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


총 게시물 73건, 최근 0 건
   

데이터베이스 access privileges

글쓴이 : PostgresDBA 날짜 : 2014-12-02 (화) 23:57 조회 : 7976
SQL> \l (소문자L) 또는 select * from pg_database 수행
                                            List of databases
      Name      |     Owner      |    ...      |        Access privileges        
----------------+----------------+-------------+---------------------------------
 postgres       | postgres       | . . . . . . | 
 scottdb        | scott          | . . . . . . | 
 template0      | postgres       | . . . . . . | =c/postgres                  
                |                |             | postgres=CTc/postgres
 template1      | postgres       | . . . . . . | =c/postgres                  
                |                |             | postgres=CTc/postgres
 test           | postgres       | . . . . . . | 
(5 rows)

postgres@[local]:5432:postgres] 
SQL> 

맨끝의 Access privileges 컬럼이 의미하는 바가 뭘까요?
전체적 의미는 다음과 같습니다.
<user> = <permissions> / <granted by>

"=c" 는 "public=c" 와 같습니다. 즉 public 유저가 생략된 걸 의미합니다.

각각이 의미하는 바는 다음과 같습니다. 
대문자 C: CREATE - 데이터베이스에 스키마를 생성할수 있는 권한
대문자 T: TEMPORARY -  데이터베이스에 임시 테이블을 생성할수 있는 권한
소문자 c: CONNECT - 데이터베이스에 접속할수 있는 권한

이왕에 오브젝트권한도 살펴볼까요?

scott@[local]:5432:scottdb] 
SQL> \dp
                             Access privileges
 Schema |   Name   | Type  |  Access privileges  | 
--------+----------+-------+---------------------+-
 public | bonus    | table |                     | 
 public | dept     | table |                     | 
 public | dummy    | table |                     | 
 public | emp      | table |                     | 
 public | salgrade | table |                     | 
 public | zzz      | table |                     | 
 scott  | test     | table | scott=arwdDxt/scott | 
(7 rows)

scott@[local]:5432:scottdb] 
SQL> 

각 문자의 의미는 다음과 같습니다.

a - INSERT
r - SELECT
w - UPDATE
d - DELETE
D - TRUNCATE
x - REFERENCES
t- TRIGGER
X - EXECUTE
U - USAGE


PostgresDBA 2016-02-04 (목) 14:37
rolename=xxxx -- privileges granted to a role
        =xxxx -- privileges granted to PUBLIC

            r -- SELECT ("read")
            w -- UPDATE ("write")
            a -- INSERT ("append")
            d -- DELETE
            D -- TRUNCATE
            x -- REFERENCES
            t -- TRIGGER
            X -- EXECUTE
            U -- USAGE
            C -- CREATE
            c -- CONNECT
            T -- TEMPORARY
      arwdDxt -- ALL PRIVILEGES (for tables, varies for other objects)
            * -- grant option for preceding privilege

        /yyyy -- role that granted this privilege

http://www.postgresql.org/docs/9.0/static/sql-grant.html
댓글주소
   

postgresdba.com