see user privileges postgres code example
Example 1: grant all privileges database postgres to user
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA schema_name TO username;
Example 2: list all permissions on a table in postgres
SELECT grantee, privilege_type
FROM information_schema.role_table_grants
WHERE table_name='mytable'
Example 3: grant all privileges database postgres to user
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA schema_name TO username;