Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 59968B5DBC1 for ; Fri, 1 Jul 2011 09:00:15 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 19657-06 for ; Fri, 1 Jul 2011 12:00:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from nm15-vm0.bullet.mail.bf1.yahoo.com (nm15-vm0.bullet.mail.bf1.yahoo.com [98.139.212.254]) by mail.postgresql.org (Postfix) with SMTP id 6EE7AB5DBC8 for ; Fri, 1 Jul 2011 09:00:07 -0300 (ADT) Received: from [98.139.212.144] by nm15.bullet.mail.bf1.yahoo.com with NNFMP; 01 Jul 2011 12:00:07 -0000 Received: from [98.139.212.226] by tm1.bullet.mail.bf1.yahoo.com with NNFMP; 01 Jul 2011 12:00:07 -0000 Received: from [127.0.0.1] by omp1035.mail.bf1.yahoo.com with NNFMP; 01 Jul 2011 12:00:07 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 49199.95385.bm@omp1035.mail.bf1.yahoo.com Received: (qmail 42621 invoked by uid 60001); 1 Jul 2011 12:00:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1309521606; bh=+1cyk+zc14c8eINrQ0QahART6w6D6yybrrMpC5uK1eI=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Subject:To:MIME-Version:Content-Type; b=NPuVOu0m1AGT+EVPD+jrrTMvRcrEoE/mqnLUtZQBl7FNZJrqjVYIlmK+w0ZTY+alz/K12f0a3qB7hN2/Pj49GNjK4iOnyDbGfvM0IoXXd03xtCCKmm54MZcfjPe+AWE2PY1WxsGBVxnPNl2BvOwQOWujsfrTpI53HT06f7cEKrM= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Subject:To:MIME-Version:Content-Type; b=ZwnxsN62QMU/gGGnPbYv0rBYMWpJMS00Qr4BudLt/TSZzrqOBbPu7ql6UKQTFtUjDn+sOxFv3Nr6r5rXWMYerujYOiqkBDyUnHEk/64ALtk3FiZ+FpNg2Do6wQMoDkp7tnn3o4P2UCFETEsgeYK6WAzELBGHJ6cQIzwkjENih4U=; X-YMail-OSG: vqfrZXwVM1k1J_iuHq_fujen.Fs9vYlFQZzBMjW9FQhkR_B mTpZ0aHWWuEJwXhLfIliNiuX9AJbkBgzRrXx9D7RRWBIMaVhEWnze6RJ3hYo y4KTUXo6Ty3e8F27HXFzNVYSfTRBub1riVlK0_frCknu6GkMZw9aa_f.rQZp HjMWEf1c8VRETcTH_fXSKrXw0q5XVCBwFhQ2CSypBshRrGboYCkfcL_w6al3 Rxsu4dKTxSmdKJxKVgJv0IrhPNmMnqZmu8_2RWYJTcuofrvaIX.WRxrZtKWl podZKx.J1gdvOaU7ASUd_CGmUDx2WuNOFnhrPd7rfjWN5q95Zzuo06TAAKwP IympVCvfJg0BorMiOr8.GfZfaBm0VdZmSEbml3HSct1M_b.G9y2tB9wI- Received: from [93.232.67.93] by web161513.mail.bf1.yahoo.com via HTTP; Fri, 01 Jul 2011 05:00:06 PDT X-Mailer: YahooMailRC/572 YahooMailWebService/0.8.112.307740 Message-ID: <1309521606.42045.YahooMailRC@web161513.mail.bf1.yahoo.com> Date: Fri, 1 Jul 2011 05:00:06 -0700 (PDT) From: salah jubeh Subject: roles To: pgsql MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1400156475-1309521606=:42045" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.908 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201107/13 X-Sequence-Number: 177392 --0-1400156475-1309521606=:42045 Content-Type: text/plain; charset=us-ascii I have two databases, I need to insure that both databases has the same roles. tables, schemas, views must have the same permissions and privileges. you can say and Identical clones. I can synchronise the roles using these statments SELECT DISTINCT 'CREATE USER '||usename||';' FROM pg_user; SELECT 'GRANT '||g.usename||' TO '||u.usename||';' FROM pg_auth_members a JOIN pg_user u ON a.member = u.usesysid JOIN pg_user g ON a.roleid = g.usesysid; SELECT 'ALTER ROLE '||usename||' WITH SUPERUSER;' FROM pg_user WHERE usesuper; --0-1400156475-1309521606=:42045 Content-Type: text/html; charset=us-ascii

 
I have two databases, I need to insure that both databases has the same roles.  tables, schemas, views must have the same permissions and privileges. you can say and Identical clones. I can synchronise the roles using these statments

SELECT DISTINCT 'CREATE USER '||usename||';' FROM pg_user;
SELECT 'GRANT '||g.usename||' TO '||u.usename||';' FROM pg_auth_members a JOIN pg_user u ON a.member = u.usesysid JOIN pg_user g ON a.roleid = g.usesysid;
SELECT 'ALTER ROLE '||usename||' WITH SUPERUSER;' FROM pg_user WHERE usesuper;
 


 

--0-1400156475-1309521606=:42045--