[Assorted-commits] SF.net SVN: assorted:[1743] shell-tools/trunk/src/bash-commons/common.bash
Brought to you by:
yangzhang
From: <yan...@us...> - 2011-01-25 00:19:46
|
Revision: 1743 http://assorted.svn.sourceforge.net/assorted/?rev=1743&view=rev Author: yangzhang Date: 2011-01-25 00:19:40 +0000 (Tue, 25 Jan 2011) Log Message: ----------- Add pg-grant-tables Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2011-01-08 02:41:57 UTC (rev 1742) +++ shell-tools/trunk/src/bash-commons/common.bash 2011-01-25 00:19:40 UTC (rev 1743) @@ -655,6 +655,18 @@ openssl enc -kfile /dev/fd/0 -in /dev/zero -aes-128-cbc > "$@" } +# Given a user, grant permissions (default: all) on all tables in some schema +# (default: public) to that user. +pg-grant-tables() { + local schema=${schema:-public} perms=${perms:-all} user=$1 + psql -A -t -c " + select 'grant $perms on '||schemaname||'.'||tablename||' to $user;' + from pg_tables + where schemaname = '$schema' + order by schemaname, tablename;" | + psql +} + #if ! is_declared indent ; then # noindent #else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |