pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: salah jubeh <s_jubeh@yahoo.com>
To: pgsql <pgsql-general@postgresql.org>
Subject: Re: roles
Date: Fri, 1 Jul 2011 05:06:49 -0700 (PDT)
Message-ID: <1309522009.86665.YahooMailRC@web161514.mail.bf1.yahoo.com> (raw)
In-Reply-To: <1309521606.42045.YahooMailRC@web161513.mail.bf1.yahoo.com>
References: <1309521606.42045.YahooMailRC@web161513.mail.bf1.yahoo.com>



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: <1309522009.86665.YahooMailRC@web161514.mail.bf1.yahoo.com>
Permalink:  ../1309522009.86665.YahooMailRC@web161514.mail.bf1.yahoo.com/
Also on:    postgresql.org/message-id/1309522009.86665.YahooMailRC@web161514.mail.bf1.yahoo.com

 · 

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: s_jubeh@yahoo.com
  Subject: Re: roles
  In-Reply-To: <1309522009.86665.YahooMailRC@web161514.mail.bf1.yahoo.com>
  References: <1309521606.42045.YahooMailRC@web161513.mail.bf1.yahoo.com> <1309522009.86665.YahooMailRC@web161514.mail.bf1.yahoo.com>

* 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