<span style>Hello,</span><div style><br></div><div style>Check this out:</div><div style><br></div><div style><div>mysql> SELECT COUNT(id) FROM Groups;</div><div>+-----------+</div><div>| count(id) |</div><div>+-----------+</div>

<div>|      4674 |</div><div>+-----------+</div><div><br></div><div>I don't think this is normal behavior since, as the administrator, I have not created this many groups (at least not intentionally). I may have an idea as to where they come from, look at this:</div>

<div><br></div><div><div>mysql> SELECT COUNT(id) FROM Groups WHERE Domain = "RT::Ticket-Role";</div><div>+-----------+</div><div>| COUNT(id) |</div><div>+-----------+</div><div>|      4496 |</div><div>+-----------+</div>

</div><div><br></div><div>We currently have about 1,100 tickets in the database. Every time a ticket is created, a scrip runs using a template that contains the following code:</div><div><br></div><div><br></div><div>--- CUT HERE</div>

<div><div>my $GroupName = ''Computer Support;</div><div> </div><div># instantiate a group object</div><div>my $addGroupObj = RT::Group->new($RT::SystemUser);</div><div>$addGroupObj->LoadUserDefinedGroup($GroupName);</div>

<div>return undef unless $addGroupObj;</div><div>my $addGroupMembersObj = $addGroupObj->UserMembersObj;</div><div> </div><div>my $res = '';</div><div># walk through members of group to do stuff</div><div>while ( my $userObj = $addGroupMembersObj->Next) {</div>

</div><div>--- CUT HERE</div><div><br></div><div>It seems that my $addGroupObj = RT::Group->new($RT::SystemUser) creates a real group in the database. Can someone confirm?</div><div><br></div><div>I figuredit could be the case so after I'm done with that $addGroupObj, I tried to clean things up by using </div>

<div><br></div><div><span style="line-height:16px;font-family:arial,helvetica,sans-serif">$addGroupObj->Delete();</span><br style="line-height:16px;font-family:arial,helvetica,sans-serif"><br>Here is the error I got in the logs:<br>

<br style="line-height:16px;font-family:arial,helvetica,sans-serif"><span style="line-height:16px;font-family:arial,helvetica,sans-serif">[Sun Jan 1 22:50:54 2012] [crit]: Deleting groups violates referential integrity until we go through and fix this (/usr/local/rt4/sbin/../lib/RT/Group.pm:627)</span></div>

<div><br></div><div>I do not believe it's healthy. I need to know if it's really my template that is causing the issue and if so, how can I gather the email addresses for each member of an existing group without creating a new one.</div>

<div><br></div><div>I use RT 4.0.4. Thank you for your help.</div><br>Haïm Dimermanas</div>