ich versuche mit einem Script einer Group Role auf allen Tabellen einer DB die Berechtigung setzen.
Mein erster Versuch mit einem Sub-select geht nicht ->
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE (SELECT tablename FROM pg_tables where tablename not like ‘pg_%’) TO users_group;
17:14 < akretschmer> ??grantall
17:14 < rtfm_please> For information about grantall
17:14 < rtfm_please> see http://pgedit.com/public/sql/acl_admin/index.html
17:14 < rtfm_please> or http://unf.be/postgresql/postgres_grant_all.perl
17:14 < rtfm_please> or http://www.archonet.com/pgdocs/grant-all.html
Ich hab jetzt ein Script (abgändertes grantall.sh) das funktioniert. Falls jemand mal das gleiche benötigt:
start of fixperm.sh
#!/bin/bash
SQL=“SELECT tablename FROM pg_tables where tablename not like ‘pg_%’ and tablename not like ‘sql_%’”
OBJ=psql -d DATABASE -t -c "${SQL}" $1
OBJ=echo ${OBJ} | sed 's/EOF//g'
OBJ=echo ${OBJ} | sed 's/ /, /g'
SQL=“GRANT SELECT, UPDATE, INSERT, DELETE ON ${OBJ} TO users_group;”
psql -d DATABASE -c “${SQL}” $1