fdb=> create table test_row(id serial primary key, username text, log_event text, create_time timestamp(0) without time zone default clock_timestamp()); CREATE TABLE fdb=> insert into test_row(username,log_event) values('user1','user1:aaa'); INSERT 0 1 fdb=> insert into test_row(username,log_event) values('user1','user1:aadsfdfa'); INSERT 0 1 fdb=> insert into test_row(username,log_event) values('user2','user2:aadsfdfa'); INSERT 0 1 fdb=> insert into test_row(username,log_event) values('user2','user2:test'); INSERT 0 1 fdb=> insert into test_row(username,log_event) values('user3','user3:test3'); INSERT 0 1 fdb=> insert into test_row(username,log_event) values('user3','user3:test3333'); INSERT 0 1 fdb=> insert into test_row(username,log_event) values('user4','user4:test3333'); INSERT 0 1
创建测试用户
创建 user1,user2,user3 测试用户
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[pg95@db1 ~]$ psql fdb psql (9.5alpha1) Type "help"for help. fdb=# create role user1 with login; CREATE ROLE fdb=# create role user2 with login; CREATE ROLE fdb=# create role user3 with login; CREATE ROLE fdb=> grant select on test_row to user1,user2,user3; GRANT fdb=> grant usage on schema fdb to user1,user2,user3; GRANT