PostgreSQL DBA part 5 :- Create user and grant privilege in postgresql

edb=# create user test identified by test;
CREATE ROLE
edb=# grant connect on database edb to test;
GRANT
edb=# grant usage on schema public to test;
GRANT
edb=# create table t(c1 char(10));
CREATE TABLE
edb=# insert into t values('DEB');
INSERT 0 1
edb=# commit;
COMMIT
edb=# grant select,insert on emp to test;
GRANT
edb=# \c edb test;
Password for user test:
You are now connected to database "edb" as user "test".
edb=> select * from emp;
 empno | ename | job | mgr | hiredate | sal | comm | de
ptno
-------+--------+-----------+------+--------------------+---------+---------+---
-----
 7369 | SMITH | CLERK | 7902 | 17-DEC-80 00:00:00 | 800.00 | |
 20

0 comments on “PostgreSQL DBA part 5 :- Create user and grant privilege in postgresql

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>