Skip to content

Instantly share code, notes, and snippets.

View tristantreb's full-sized avatar

tristan tristantreb

View GitHub Profile
@tristantreb
tristantreb / read-access.sql
Created June 5, 2023 16:35 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing schemas & tables, and to future tables (as of now you can't grant access to future schemas)
DO
$do$
DECLARE
sch text;
BEGIN
FOR sch IN