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


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org/

Reply via email to