
GRANT USAGE ON SCHEMA "system" TO heimdall;
GRANT CREATE ON SCHEMA "system" TO heimdall

create schema "system"

 ALTER DEFAULT PRIVILEGES FOR ROLE heimdall IN SCHEMA "system" 
GRANT ALL PRIVILEGES ON TABLES TO heimdall;

-- Og for eksisterende tabeller
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA "system" TO heimdall;

 ALTER TABLE susers OWNER TO db_admin;
 GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA your_schema TO sathumper;
 
 
 CREATE ROLE heimdall WITH LOGIN PASSWORD '3911';
COMMENT ON ROLE heimdall IS 'Security auditor and guardian';
drop role heimdall


set role 'heimdall'
ALTER ROLE heimdall SET search_path = "system"
drop table system.foo

SELECT CURRENT_ROLE;
SELECT rolname FROM pg_roles
select system_user()

SET ROLE heimdall;
RESET ALL;  -- Nulstil alle sessionsvariabler til deres standardværdier
SHOW search_path;  -- Burde nu vise den konfigurerede værdi

SHOW search_path;

create table system.foos(id int)

select * from system.foo
select * from "system".organizations


