Re: drop role with privileges

Поиск
Список
Период
Сортировка
От Tom Darci
Тема Re: drop role with privileges
Дата
Msg-id A70D5EAEADAEB6438A262830763338A964AD6A@MI8NYCMAIL16.Mi8.com
обсуждение исходный текст
Ответ на drop role with privileges  ("Tom Darci" <tom@nuws.com>)
Список 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: TOAD-like query builder for PostgreSQL?
Следующее
От: "Tom Darci"
Дата:
Сообщение: Re: drop role with privileges