Обсуждение: Replicating privileges from one user to another

Поиск
Список
Период
Сортировка

Replicating privileges from one user to another

От
Mario Splivalo
Дата:
I have user foo that is owner of database dbfoo. Now I need to create
user baz that will have the exact same privileges as user foo on
database baz. I've tried this:

GRANT ALL ON DATABASE dbfoo TO baz;

but I still can't select form tables.

Is there a easier way, or do I need to go trough all the
tables/views/functions/schemas and issue GRANT ALL ON ... TO USER baz?

    Mario

Re: Replicating privileges from one user to another

От
"Kevin Grittner"
Дата:
Mario Splivalo <mario.splivalo@megafon.hr> wrote:

> I have user foo that is owner of database dbfoo. Now I need to
> create user baz that will have the exact same privileges as user
> foo on database baz. I've tried this:
>
> GRANT ALL ON DATABASE dbfoo TO baz;
>
> but I still can't select form tables.

Did you mean that you want user baz to have the same privileges on
as user foo on database dbfoo?

If so, how about:

GRANT foo TO baz;

A USER is just a ROLE with login privileges -- you can make other
roles a member of the role. Be aware that if you do it this way, any
privileges later granted to or revoked from foo will also affect
baz.  (I don't know whether that's what you want.)

-Kevin