pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedroles
9+ messages / 6 participants
[nested] [flat]
* roles
@ 2011-07-01 12:00 salah jubeh <s_jubeh@yahoo.com>
0 siblings, 1 reply; 9+ messages in thread
From: salah jubeh @ 2011-07-01 12:00 UTC (permalink / raw)
To: pgsql-general
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;
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: roles
@ 2011-07-01 12:06 salah jubeh <s_jubeh@yahoo.com>
parent: salah jubeh <s_jubeh@yahoo.com>
0 siblings, 2 replies; 9+ messages in thread
From: salah jubeh @ 2011-07-01 12:06 UTC (permalink / raw)
To: pgsql-general
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
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: roles
@ 2011-07-01 12:39 Rob Richardson <Rob.Richardson@rad-con.com>
parent: salah jubeh <s_jubeh@yahoo.com>
1 sibling, 0 replies; 9+ messages in thread
From: Rob Richardson @ 2011-07-01 12:39 UTC (permalink / raw)
To: salah jubeh <s_jubeh@yahoo.com>; pgsql-general
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
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: roles
@ 2011-07-01 12:49 Chris Travers <chris.travers@gmail.com>
parent: salah jubeh <s_jubeh@yahoo.com>
1 sibling, 0 replies; 9+ messages in thread
From: Chris Travers @ 2011-07-01 12:49 UTC (permalink / raw)
To: salah jubeh <s_jubeh@yahoo.com>; +Cc: pgsql-general
On Fri, Jul 1, 2011 at 5:06 AM, salah jubeh <s_jubeh@yahoo.com> wrote:
>
> 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
I guess it kinda depends on what you are trying to do.
If these are db's on the same db cluster, then no action is necessary
since roles are shared among databases. If they are on different
clusters and servers, I think your approach will fail to synchronize
passwords if those are required. I would probably do a pg_dumpall -s
and use grep to pullout the create/alter role statements along with
grants.
Best wishes,
Chris Travers
^ permalink raw reply [nested|flat] 9+ messages in thread
* Roles
@ 2021-09-14 20:13 Gambhir Singh <gambhir.singh05@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Gambhir Singh @ 2021-09-14 20:13 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi,
I'm having 4 Databases in the AWS RDS Cluster. Just wanna to know how to
create roles which are specific to each database, because when I'm creating
roles in one Database, they are visible in other Databases.
Thanks & Regards
Gambhir Singh
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Roles
@ 2021-09-14 23:11 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Gambhir Singh <gambhir.singh05@gmail.com>
0 siblings, 2 replies; 9+ messages in thread
From: Adrian Klaver @ 2021-09-14 23:11 UTC (permalink / raw)
To: Gambhir Singh <gambhir.singh05@gmail.com>; pgsql-general@lists.postgresql.org
On 9/14/21 1:13 PM, Gambhir Singh wrote:
> Hi,
>
> I'm having 4 Databases in the AWS RDS Cluster. Just wanna to know how to
> create roles which are specific to each database, because when I'm
> creating roles in one Database, they are visible in other Databases.
You can't, roles are global objects in a cluster.
>
> Thanks & Regards
> Gambhir Singh
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Roles
@ 2021-09-15 03:25 Gambhir Singh <gambhir.singh05@gmail.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 0 replies; 9+ messages in thread
From: Gambhir Singh @ 2021-09-15 03:25 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general@lists.postgresql.org
Thank you for the clarification.
On Tue, 14 Sep 2021, 18:11 Adrian Klaver, <adrian.klaver@aklaver.com> wrote:
> On 9/14/21 1:13 PM, Gambhir Singh wrote:
> > Hi,
> >
> > I'm having 4 Databases in the AWS RDS Cluster. Just wanna to know how to
> > create roles which are specific to each database, because when I'm
> > creating roles in one Database, they are visible in other Databases.
>
> You can't, roles are global objects in a cluster.
>
> >
> > Thanks & Regards
> > Gambhir Singh
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Roles
@ 2021-09-15 12:36 Simon Riggs <simon.riggs@enterprisedb.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 1 reply; 9+ messages in thread
From: Simon Riggs @ 2021-09-15 12:36 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Gambhir Singh <gambhir.singh05@gmail.com>; pgsql-general@lists.postgresql.org
On Wed, 15 Sept 2021 at 00:11, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>
> On 9/14/21 1:13 PM, Gambhir Singh wrote:
> > Hi,
> >
> > I'm having 4 Databases in the AWS RDS Cluster. Just wanna to know how to
> > create roles which are specific to each database, because when I'm
> > creating roles in one Database, they are visible in other Databases.
>
> You can't, roles are global objects in a cluster.
Roles are global objects that are visible in all databases.
But you can GRANT the CONNECT privilege for a role to only specific databases.
--
Simon Riggs http://www.EnterpriseDB.com/
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Roles
@ 2021-09-15 18:04 Gambhir Singh <gambhir.singh05@gmail.com>
parent: Simon Riggs <simon.riggs@enterprisedb.com>
0 siblings, 0 replies; 9+ messages in thread
From: Gambhir Singh @ 2021-09-15 18:04 UTC (permalink / raw)
To: Simon Riggs <simon.riggs@enterprisedb.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org
Thanks alot
On Wed, 15 Sep 2021, 07:36 Simon Riggs, <simon.riggs@enterprisedb.com>
wrote:
> On Wed, 15 Sept 2021 at 00:11, Adrian Klaver <adrian.klaver@aklaver.com>
> wrote:
> >
> > On 9/14/21 1:13 PM, Gambhir Singh wrote:
> > > Hi,
> > >
> > > I'm having 4 Databases in the AWS RDS Cluster. Just wanna to know how
> to
> > > create roles which are specific to each database, because when I'm
> > > creating roles in one Database, they are visible in other Databases.
> >
> > You can't, roles are global objects in a cluster.
>
> Roles are global objects that are visible in all databases.
>
> But you can GRANT the CONNECT privilege for a role to only specific
> databases.
>
> --
> Simon Riggs http://www.EnterpriseDB.com/
>
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2021-09-15 18:04 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-07-01 12:00 roles salah jubeh <s_jubeh@yahoo.com>
2011-07-01 12:06 ` salah jubeh <s_jubeh@yahoo.com>
2011-07-01 12:39 ` Rob Richardson <Rob.Richardson@rad-con.com>
2011-07-01 12:49 ` Chris Travers <chris.travers@gmail.com>
2021-09-14 20:13 Roles Gambhir Singh <gambhir.singh05@gmail.com>
2021-09-14 23:11 ` Re: Roles Adrian Klaver <adrian.klaver@aklaver.com>
2021-09-15 03:25 ` Re: Roles Gambhir Singh <gambhir.singh05@gmail.com>
2021-09-15 12:36 ` Re: Roles Simon Riggs <simon.riggs@enterprisedb.com>
2021-09-15 18:04 ` Re: Roles Gambhir Singh <gambhir.singh05@gmail.com>
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