
drop user if exists ref;


drop user if exists cust;


drop user if exists report;


drop user if exists xact;


/* Reference data */
GRANT INSERT, UPDATE, DELETE ON pgbench_tellers TO ref;
GRANT INSERT, UPDATE, DELETE ON pgbench_branches TO ref;

/* Customer maintenance */
GRANT INSERT, DELETE ON pgbench_accounts TO cust;
GRANT UPDATE (bid, filler) ON pgbench_accounts TO cust; 

/* Reporting */
GRANT SELECT ON pgbench_accounts TO report;
GRANT SELECT ON pgbench_branches TO report;
GRANT SELECT ON pgbench_tellers TO report;
GRANT SELECT ON pgbench_history TO report;

/* Transactions */
GRANT UPDATE (abalance) ON pgbench_accounts TO xact;
GRANT UPDATE (tbalance) ON pgbench_tellers TO xact;
GRANT UPDATE (bbalance) ON pgbench_branches TO xact;
GRANT INSERT ON pgbench_history TO xact;
GRANT SELECT ON pgbench_accounts TO xact;
GRANT SELECT ON pgbench_branches TO xact;
GRANT SELECT ON pgbench_tellers TO xact;
GRANT SELECT ON pgbench_history TO xact;



