pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Richardson <Rob.Richardson@rad-con.com>
To: salah jubeh <s_jubeh@yahoo.com>
To: pgsql <pgsql-general@postgresql.org>
Subject: Re: roles
Date: Fri, 1 Jul 2011 08:39:13 -0400
Message-ID: <04A6DB42D2BA534FAC77B90562A6A03D018A67EE@server.rad-con.local> (raw)
In-Reply-To: <1309522009.86665.YahooMailRC@web161514.mail.bf1.yahoo.com>

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 = 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



 

 

view thread (9+ messages)  latest in thread

Message-ID: <04A6DB42D2BA534FAC77B90562A6A03D018A67EE@server.rad-con.local>
Permalink:  ../04A6DB42D2BA534FAC77B90562A6A03D018A67EE@server.rad-con.local/
Also on:    postgresql.org/message-id/04A6DB42D2BA534FAC77B90562A6A03D018A67EE@server.rad-con.local

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: Rob.Richardson@rad-con.com, s_jubeh@yahoo.com
  Subject: Re: roles
  In-Reply-To: <04A6DB42D2BA534FAC77B90562A6A03D018A67EE@server.rad-con.local>
  References: <1309522009.86665.YahooMailRC@web161514.mail.bf1.yahoo.com> <04A6DB42D2BA534FAC77B90562A6A03D018A67EE@server.rad-con.local>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox