Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id D4E9CB5DC1D for ; Fri, 1 Jul 2011 09:06:56 -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 32786-01 for ; Fri, 1 Jul 2011 12:06:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from nm25.bullet.mail.bf1.yahoo.com (nm25.bullet.mail.bf1.yahoo.com [98.139.212.184]) by mail.postgresql.org (Postfix) with SMTP id 1A5F1B5DBD6 for ; Fri, 1 Jul 2011 09:06:49 -0300 (ADT) Received: from [98.139.212.151] by nm25.bullet.mail.bf1.yahoo.com with NNFMP; 01 Jul 2011 12:06:49 -0000 Received: from [98.139.212.194] by tm8.bullet.mail.bf1.yahoo.com with NNFMP; 01 Jul 2011 12:06:49 -0000 Received: from [127.0.0.1] by omp1003.mail.bf1.yahoo.com with NNFMP; 01 Jul 2011 12:06:49 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 786055.47519.bm@omp1003.mail.bf1.yahoo.com Received: (qmail 94528 invoked by uid 60001); 1 Jul 2011 12:06:49 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1309522009; bh=O0s8UFbAnN1GDZGhqYxuW4eaklKYiIT4Zt9lTpt9AQ4=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=xMBdpvhsvYVMC3gFcbOV2tryly5SVNMV7LlwL+XDsc/tIx+eDy9H7+7QVn+mks2JqbrhBAYciHaHXmQJvFxfybDNqDwf08G6Cof7B7gH97fbDpWpCpeicNLX6QEdf6mv5ZcNnES7ABc+jzyLU2frnkHKpXCw5h/Nfg35B8AJHFA= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=hszcP2rHmzjMToBLw8l4q3+DKwcB4C5JCWWMJ+tkyWSzwFAVnkvkea1kexDjSt9JDN90pZdTuDZ2d2KVnuqBnCl3STsve0iJP/e/J4esdaevXPkiC6f0wMXFjlJY7+zQlFXtmXDbOSNdc2ubV/Chyzjwr/fej7vJTuwEiv8POwM=; X-YMail-OSG: SXfOVLkVM1kMH0eu7PdfE3qq4jT5.ezHu86dKaZwnuDc.oH 3B_z51Zr.MFWY7njcainJ6haBw_s88kVLjNbzC6ZvPI0aiwNCy8HTv7WPPYn cXB6zv4MPDx_wB1i46eC61Ed0PbE3Y51yufDNI4FxfSe6rToh0JznVikuDsz cQUJq75L1oJqqLWz9.EsxUAvE2zGuP1.qznQHt_zBGNRmAznqYSwDh2cL7Pp k2MIqYu8AvmBvL3hzW1wVgfFrfPda8pIX.9Q6dDMhGpDf2QCb8IMUFlTQdow KMwoSQeb_JfbPKOICrD_EP3IRnTmc8Hmbx9GwIT7Md7U9qozCmqQqA7R4FU_ dBmgbaE01ld0.lzKSW0bS0eBO3LXVIAppqIpY8P5NFHEUZDmczMYzSA-- Received: from [93.232.67.93] by web161514.mail.bf1.yahoo.com via HTTP; Fri, 01 Jul 2011 05:06:49 PDT X-Mailer: YahooMailRC/572 YahooMailWebService/0.8.112.307740 References: <1309521606.42045.YahooMailRC@web161513.mail.bf1.yahoo.com> Message-ID: <1309522009.86665.YahooMailRC@web161514.mail.bf1.yahoo.com> Date: Fri, 1 Jul 2011 05:06:49 -0700 (PDT) From: salah jubeh Subject: Re: roles To: pgsql In-Reply-To: <1309521606.42045.YahooMailRC@web161513.mail.bf1.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-899253426-1309522009=:86665" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.009 tagged_above=-5 required=5 tests=BAYES_20=-0.001, 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/14 X-Sequence-Number: 177393 --0-899253426-1309522009=:86665 Content-Type: text/plain; charset=us-ascii Hello, 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 synchronize the roles using these statements 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; However, How can I synchronize the privileges that are assigned to the database entities i.e. schemas , tables, and views. If that solution is not possible, how can I create an identical clone of my database including roles. when I use pg_restore normally the owner of the tables are changed and you need to recreate the roles in advance Regards --0-899253426-1309522009=:86665 Content-Type: text/html; charset=us-ascii

Hello,
 
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 synchronize the roles using these statements

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;


  However, How can I synchronize the privileges that are assigned to the database entities i.e. schemas , tables, and views.


If that solution is not possible, how can I create an identical clone of my database including roles. when I use pg_restore normally the owner of the tables are changed and you need to recreate the roles in advance

Regards


 

--0-899253426-1309522009=:86665--