Eli Mesika has posted comments on this change.

Change subject: core: adding utility for db objects owner change
......................................................................


Patch Set 1:

(2 comments)

....................................................
File packaging/setup/dbutils/postgres2engineowner.sh
Line 4: ################################################################
Line 5: #!/bin/sh
Line 6: 
Line 7: cmd="select c.relname from   pg_class c join pg_roles r on r.oid = 
c.relowner join pg_namespace n on n.oid = c.relnamespace where  c.relkind in 
('r','v','S') and    n.nspname = 'public' and r.rolname != 'engine';"
Line 8: res=$(psql -w --pset=tuples_only=on --set ON_ERROR_STOP=1 -c "${cmd}" 
-U postgres engine)
Done
Line 9: if [ -n "${res}" ]; then
Line 10:     cmd=""
Line 11:     for tab in $(echo $res); do
Line 12:         cmd=${cmd}"alter table $tab owner to engine; "


Line 8: res=$(psql -w --pset=tuples_only=on --set ON_ERROR_STOP=1 -c "${cmd}" 
-U postgres engine)
Line 9: if [ -n "${res}" ]; then
Line 10:     cmd=""
Line 11:     for tab in $(echo $res); do
Line 12:         cmd=${cmd}"alter table $tab owner to engine; "
Right , I had found a simple approach to change all objects using pg_dump 
utility , see my next patch
Line 13:     done
Line 14:     if [ -n "${cmd}" ]; then
Line 15:         echo "Changing ownership of objects in database engine to 
owner engine ... "
Line 16:         res=$(psql -w --pset=tuples_only=on --set ON_ERROR_STOP=1 -c 
"${cmd}" -U postgres engine)


-- 
To view, visit http://gerrit.ovirt.org/18682
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I56c59c0fe749389bd110bcd1a39faae74e71174b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to