MoroGasper / yii-usergroups

Automatically exported from code.google.com/p/yii-usergroups
0 stars 0 forks source link

Installation fails on creating usergroups_group table because of uniqe id violation #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Installing userGroups module on ubuntu+postgresql

What is the expected output? What do you see instead?
Installation should proceed to see the admin home page

Instead, Installation fails with a message stating unique id violation, when 
trying to add USER group at usergroups_group table.

What version of the product are you using? On what operating system?
Ubuntu 11.04
UserGroups 1.7.1
Postgresql 8.4

Please provide any additional information below.

by not specifying the id, postgresql will choose next value of the sequence, 
which is 1, because this is the first time sequence is used for number 
generation, and default start value is 1. but ROOT group with the same id was 
created before

Original issue reported on code.google.com by APajooha...@gmail.com on 4 Aug 2011 at 6:51

GoogleCodeExporter commented 9 years ago
thanks for the support.

unfortunately here i don't have a postgres environment where can i actually 
test queries, so could you please help me and tell which query may reset the 
autoincrement to avoid this problem?

thanks a lot :D

Original comment by nic...@creationgears.com on 5 Aug 2011 at 8:08

GoogleCodeExporter commented 9 years ago
currently, i think of two ways:
the first and simple one, is to change the ROOT constant from 1 to 0

second fix is to change sequence initial value to 2, to avoid conflict with 
root id
i.e. executing SELECT nextval('usergroups_user_id_seq', 2) somewhere before 
trying to add the USER group (bacuase, manual setting of ROOT group id, will 
not trigger sequence at all, and we need to set the proper initial value 
manually too!)

if you want my help somewhere in fixing this issue, just let me know.

Original comment by APajooha...@gmail.com on 6 Aug 2011 at 7:47