Re: pg_dump and roles - Mailing list pgsql-admin

From Alvaro Herrera
Subject Re: pg_dump and roles
Date
Msg-id 20081003173550.GE3817@alvh.no-ip.org
Whole thread Raw
In response to pg_dump and roles  (Julie Warden <Julie_Warden@nospam.hotmail.com>)
Responses Re: pg_dump and roles
List pgsql-admin
Julie Warden wrote:

> Is there a method to dump just the roles from a database, or otherwise
> select them, so I can build a script to reload the roles? Otherwise, I
> guess I'll just read the tables for each database and build the
> security script from that.

Roles are not per-database; they are global objects.  You can get a dump
of all the roles with pg_dumpall -g.

If you really need to filter out roles per database, my best suggestion
is to filter a global role dump them with the pg_shdepend catalog for
each database.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-admin by date:

Previous
From: Julie Warden
Date:
Subject: pg_dump and roles
Next
From: "Peter Steinheuser"
Date:
Subject: Re: pg_dump and roles