Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id E44ADB5DBDE for ; Fri, 1 Jul 2011 09:39:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 70687-04 for ; Fri, 1 Jul 2011 12:39:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www1.brickcitywebs.net (www1.brickcitywebs.net [8.8.67.10]) by mail.postgresql.org (Postfix) with ESMTP id DC517B5DBC8 for ; Fri, 1 Jul 2011 09:39:15 -0300 (ADT) Received: (qmail 6722 invoked from network); 1 Jul 2011 08:38:53 -0400 Received: from softdnserror (HELO outlook.rad-con.com) (12.49.144.162) by www1.brickcitywebs.net with SMTP; 1 Jul 2011 08:38:52 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CC37EB.E12250D1" Subject: Re: roles Date: Fri, 1 Jul 2011 08:39:13 -0400 Message-ID: <04A6DB42D2BA534FAC77B90562A6A03D018A67EE@server.rad-con.local> In-Reply-To: <1309522009.86665.YahooMailRC@web161514.mail.bf1.yahoo.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [GENERAL] roles Thread-Index: Acw355I/4IxzRFTHS5eqmprs/wQSuwAA9XWA From: "Rob Richardson" To: "salah jubeh" , "pgsql" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201107/15 X-Sequence-Number: 177394 This is a multi-part message in MIME format. ------_=_NextPart_001_01CC37EB.E12250D1 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable As I understand things, roles are not specific to databases. In PGAdmin, when I connect to a server, I see five collections of objects: databases, tablespaces, jobs, group roles, and login roles. Roles are separate from databases. So, for a given server, login and group roles apply to all databases on that server. =20 =20 Roles can be exported using pg_dump's "global" option, which I think is "-g". Check the help for pg_dump. =20 Good luck! =20 RobR, whose advice may well be worth what you have paid for it. =20 ________________________________ From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of salah jubeh Sent: Friday, July 01, 2011 8:07 AM To: pgsql Subject: Re: [GENERAL] roles =20 =20 Hello, =20 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 =3D u.usesysid JOIN pg_user g ON a.roleid = =3D 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 =20 =20 ------_=_NextPart_001_01CC37EB.E12250D1 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

As I understand things, roles are = not specific to databases.  In PGAdmin, when I connect to a server, I = see five collections of objects:  databases, tablespaces, jobs, group roles, = and login roles.  Roles are separate from databases.  So, for a given server, login = and group roles apply to all databases on that server.  =

 

Roles can be exported using = pg_dump’s “global” option, which I think is “-g”.  = Check the help for pg_dump.

 

Good = luck!

 

RobR, whose advice may well be = worth what you have paid for it.

 


From: pgsql-general-owner@postgresql.org = [mailto:pgsql-general-owner@postgresql.org] On Behalf Of salah jubeh
Sent: Friday, July 01, = 2011 8:07 AM
To: pgsql
Subject: Re: [GENERAL] = roles

 

 

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 =3D u.usesysid JOIN pg_user g ON a.roleid =3D 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

 

 

=
------_=_NextPart_001_01CC37EB.E12250D1--