Thread: 8.0 -> 8.1 migration issue with ROLEs ... maybe?

8.0 -> 8.1 migration issue with ROLEs ... maybe?

From
"Marc G. Fournier"
Date:
I just setup a test 8.1 server, to see how things work as far as the new 
roles system is concerned, as it relates to migrating from 8.0->8.1 ... 
specifically since there doesn't appear to be anything in HISTORY 
concerning migrating up to 8.1 from 8.0 concerning this ...

As expected:

template1=# create group a_test_group;
CREATE ROLE
template1=# create user a_test_user in group a_test_group;
CREATE ROLE
template1=#

but:

template1=# create user a_test_group in group a_test_group;
ERROR:  role "a_test_group" already exists
template1=#

So, if I have a group that happens to have a userid matching it, in the 
old system, its going to fail to load?

Whereas, under 8.0, it does work:

test=# create user a_test_group in group a_test_group;
CREATE USER
test=#

Is there something I'm missing here, as far as ensuring a 'clean' 
migration from pre-ROLEs?


----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org           Yahoo!: yscrappy              ICQ: 7615664


Re: 8.0 -> 8.1 migration issue with ROLEs ... maybe?

From
Tom Lane
Date:
"Marc G. Fournier" <scrappy@postgresql.org> writes:
> template1=# create user a_test_group in group a_test_group;
> ERROR:  role "a_test_group" already exists

> So, if I have a group that happens to have a userid matching it, in the 
> old system, its going to fail to load?

Groups and users are the same thing now, so the above isn't unexpected.
I think though that if you just ignore the error, it'll still work the
way you want --- the same role can serve as both a user and a group.

If the script tries to create the group first, you might needALTER USER a_test_group LOGIN;
to enable the role to login as a user.
        regards, tom lane