Connect to postgres with different privileges
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