Connect to postgres with different privileges From python program, I want to connect to postgres with various privileges.

lower_privileges = connect(db, username, password)
higher_privileges = connect(db, username, password)


How do I setup postgres 9.5 on arch linux, so I can do that?

create database dbone; 
grant all privileges on dbone.* to 'writer'@'localhost' identified by 'pass';
grant select on dbone.* to 'reader'@'localhost' identified by 'pass';


The problem is I enter createdb dbone then psql then grant all privileges on database dbone to writer; and I get "db does not exist error" then I exit psql and go dropdb dbone and get "db does not exist"
From the arch guide


sudo pacman -S postgresql
su - postgres
initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'
exit
Start postgres service sudo systemctl start postgres.service


&nbsp;


Check admin stuff


Set postgres system user pass passwd postgres PASS
su - postgres
Optional, you could set connection host rules vim data/pg_hba.conf
psql
Set admin DB pass \password PASS

Create db create database dbone;
Add users, grant privileges


create user writer --interactive -P;
create user reader --interactive -P;
give all privileges to writer user grant all privileges on database "dbone" to writer;
Quit \q
Connect to your db psql dbone
For tables in the public schema of your db, automatically give select privileges to reader user ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO reader;
\q, &nbsp; exit