| From: | "Tom Darci" <tom(at)nuws(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: drop role with privileges |
| Date: | 2006-12-11 15:24:00 |
| Message-ID: | A70D5EAEADAEB6438A262830763338A964AD6A@MI8NYCMAIL16.Mi8.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
>>
>> That sounds very promising. I'll take a look there.
>
>I may be wrong about the table name but certainly drop role uses some
>set of system tables to do it's work. :)
THANKS for your help, Stephen. Once I've reassigned ownership
I can then easily find out privilege dependencies using
pg_shdepend. Here's the preliminary query I've worked up for
coming up with the listing, in case it's of use to others...
------------------------------------------------------
select
rol.rolname as thisrole,
db.datname as dbname,
sch.nspname as dependencyschema,
c.relname as dependency
from
pg_shdepend as d
inner join pg_database as db on d.dbid = db.oid
inner join pg_authid as rol on d.refobjid = rol.oid
left join (pg_class as c inner join pg_namespace as sch on
c.relnamespace = sch.oid) on d.objid = c.oid where
rol.rolname = '<WhateverRoleNameYouLike>'
and d.deptype in ('o', 'a')
order by
rol.rolname,
db.datname,
sch.nspname,
c.relname
------------------------------------------------------
I've included a left join in there for the case where there
are items outside the current database or that are not
otherwise in pg_class... not sure if I need that, but it's in
there for now... will probably remove to optimize (and handle
the case elsewise)
-Tom D
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Darci | 2006-12-11 15:27:53 | Re: drop role with privileges |
| Previous Message | Scott Marlowe | 2006-12-11 15:15:34 | Re: TOAD-like query builder for PostgreSQL? |