Обсуждение: BUG #1964: Role membership error

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

BUG #1964: Role membership error

От
"Kevin Walker"
Дата:
The following bug has been logged online:

Bug reference:      1964
Logged by:          Kevin Walker
Email address:      kwalker@ameritrade.com
PostgreSQL version: 8.1 beta 3
Operating system:   Windows XP
Description:        Role membership error
Details:

I created a group role called dbadmin and assigned it the privileges that I
wanted.  I then created a new login role and attempted to add this new login
as a member in the group role.  The following error is generated in pgAdmin
III and when the same steps are performed manually.

   ERROR: role "dbadmin" is a member of role "kw"

The message suggests that the login role "kw" is already a member of group
role "dbadmin" which is not the case.  Using the alter group command also
produces the same error.

This problem is occurring on the build for Windows.  I have not tested this
process on a Linux build yet.

Re: BUG #1964: Role membership error

От
Bruce Momjian
Дата:
Kevin Walker wrote:
>
> The following bug has been logged online:
>
> Bug reference:      1964
> Logged by:          Kevin Walker
> Email address:      kwalker@ameritrade.com
> PostgreSQL version: 8.1 beta 3
> Operating system:   Windows XP
> Description:        Role membership error
> Details:
>
> I created a group role called dbadmin and assigned it the privileges that I
> wanted.  I then created a new login role and attempted to add this new login
> as a member in the group role.  The following error is generated in pgAdmin
> III and when the same steps are performed manually.
>
>    ERROR: role "dbadmin" is a member of role "kw"
>
> The message suggests that the login role "kw" is already a member of group
> role "dbadmin" which is not the case.  Using the alter group command also
> produces the same error.
>
> This problem is occurring on the build for Windows.  I have not tested this
> process on a Linux build yet.

What were you trying, exactly?   It worked for me:

    test=> CREATE ROLE dbadmin;
    CREATE ROLE
    test=> CREATE ROLE kw;
    CREATE ROLE
    test=> GRANT dbadmin TO kw;
    GRANT ROLE

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: BUG #1964: Role membership error

От
Tom Lane
Дата:
"Kevin Walker" <kwalker@ameritrade.com> writes:
>    ERROR: role "dbadmin" is a member of role "kw"

> The message suggests that the login role "kw" is already a member of group
> role "dbadmin" which is not the case.

I think you are reading it backwards.  You're probably accidentally
trying to set up circular role memberships, which isn't allowed.
Observe:

regression=# create role dbadmin;
CREATE ROLE
regression=# create role kw;
CREATE ROLE
regression=# grant kw to dbadmin;
GRANT ROLE
regression=# grant kw to dbadmin;
NOTICE:  role "dbadmin" is already a member of role "kw"
GRANT ROLE
regression=# grant dbadmin to kw;
ERROR:  role "dbadmin" is a member of role "kw"

Note that re-granting is only a NOTICE not an ERROR.

            regards, tom lane