Skip to content

Instantly share code, notes, and snippets.

@mmalmeida
Created April 11, 2017 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmalmeida/d8070780071d3432610cabb3747e7aae to your computer and use it in GitHub Desktop.
Save mmalmeida/d8070780071d3432610cabb3747e7aae to your computer and use it in GitHub Desktop.
Postgres grant all to selected user
SELECT u.groname
FROM pg_database d
JOIN pg_group u ON (d.datdba = u.grosysid)
WHERE d.datname = (SELECT current_database());
CREATE SCHEMA IF NOT EXISTS mySchema;
GRANT ALL ON SCHEMA mySchema TO select_above;
CREATE SCHEMA IF NOT EXISTS mySchema2;
GRANT ALL ON SCHEMA mySchema2 TO select_above;
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment