CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • unable to delete groups has parent
Pages: [1]

Author Topic: unable to delete groups has parent  (Read 2074 times)

rampkrm

  • Guest
unable to delete groups has parent
October 17, 2008, 03:59:39 am
i have upgraded drupal to 6.5 and civicrm to 2.1 statble. i am unable to delete a group which has parent items. i checked this in civicrm sandbox but it works fine there.

can anyone guide me to right direction to resolve this error.

ref link:http://issues.civicrm.org/jira/browse/CRM-1631

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: unable to delete groups has parent
October 17, 2008, 07:44:42 am

Can u cut-n-paste the more detailed error message that gets thrown

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

rampkrm

  • Guest
Re: unable to delete groups has parent
October 22, 2008, 02:02:27 am
Pasted the error in pastebin. if you need any more details to diagnose the error let me know.

http://pastebin.ca/1233618

Sorry. A non-recoverable error has occurred.

DB Error: constraint violation

Database Error Code: Cannot delete or update a parent row: a foreign key constraint fails (`fpwr_civicrm21/civicrm_group_nesting`, CONSTRAINT `FK_civicrm_group_nesting_child_group_id` FOREIGN KEY (`child_group_id`) REFERENCES `civicrm_group` (`id`)), 1451

Return to home page.


Error Details:

Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => DELETE FROM civicrm_group  WHERE (  civicrm_group.id = 11 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`fpwr_civicrm21/civicrm_group_nesting`, CONSTRAINT `FK_civicrm_group_nesting_child_group_id` FOREIGN KEY (`child_group_id`) REFERENCES `civicrm_group` (`id`))]
    [type] => DB_Error
    [user_info] => DELETE FROM civicrm_group  WHERE (  civicrm_group.id = 11 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`fpwr_civicrm21/civicrm_group_nesting`, CONSTRAINT `FK_civicrm_group_nesting_child_group_id` FOREIGN KEY (`child_group_id`) REFERENCES `civicrm_group` (`id`))]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="DELETE FROM civicrm_group  WHERE (  civicrm_group.id = 11 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`fpwr_civicrm21/civicrm_group_nesting`, CONSTRAINT `FK_civicrm_group_nesting_child_group_id` FOREIGN KEY (`child_group_id`) REFERENCES `civicrm_group` (`id`))]"]
)

backTrace

/var/www/html/fpwrmove/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 138
, handle,
/var/www/html/fpwrmove/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 912
/var/www/html/fpwrmove/sites/all/modules/civicrm/packages/DB.php, PEAR_Error, 966
/var/www/html/fpwrmove/sites/all/modules/civicrm/packages/PEAR.php, DB_Error, 574
/var/www/html/fpwrmove/sites/all/modules/civicrm/packages/DB/common.php, raiseError, 1903
/var/www/html/fpwrmove/sites/all/modules/civicrm/packages/DB/mysql.php, raiseError, 898
/var/www/html/fpwrmove/sites/all/modules/civicrm/packages/DB/mysql.php, mysqlRaiseError, 327
/var/www/html/fpwrmove/sites/all/modules/civicrm/packages/DB/common.php, simpleQuery, 1216
/var/www/html/fpwrmove/sites/all/modules/civicrm/packages/DB/DataObject.php, query, 2394
/var/www/html/fpwrmove/sites/all/modules/civicrm/packages/DB/DataObject.php, _query, 1411
/var/www/html/fpwrmove/sites/all/modules/civicrm/CRM/Contact/BAO/Group.php, delete, 121
/var/www/html/fpwrmove/sites/all/modules/civicrm/CRM/Group/Form/Edit.php, discard, 279
/var/www/html/fpwrmove/sites/all/modules/civicrm/CRM/Core/Form.php, postProcess, 247
/var/www/html/fpwrmove/sites/all/modules/civicrm/CRM/Core/StateMachine.php, mainProcess, 166
/var/www/html/fpwrmove/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php, perform, 63
/var/www/html/fpwrmove/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 203
/var/www/html/fpwrmove/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 103
/var/www/html/fpwrmove/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 232
/var/www/html/fpwrmove/sites/all/modules/civicrm/CRM/Core/Page/Basic.php, run, 325
/var/www/html/fpwrmove/sites/all/modules/civicrm/CRM/Core/Page/Basic.php, edit, 170
/var/www/html/fpwrmove/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 197
/var/www/html/fpwrmove/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 315
, civicrm_invoke,
/var/www/html/fpwrmove/includes/menu.inc, call_user_func_array, 348
/var/www/html/fpwrmove/index.php, menu_execute_active_handler, 18

rampkrm

  • Guest
Re: unable to delete groups has parent
October 22, 2008, 11:40:14 pm
thanks lobo the problem fixed by deleting the table civicrm_group_nesting and created with
Code: [Select]
CREATE TABLE IF NOT EXISTS `civicrm_group_nesting` (
  `id` int(10) unsigned NOT NULL auto_increment COMMENT 'Relationship ID',
  `child_group_id` int(10) unsigned NOT NULL COMMENT 'ID of the child group',
  `parent_group_id` int(10) unsigned NOT NULL COMMENT 'ID of the parent group',
  PRIMARY KEY  (`id`),
  KEY `FK_civicrm_group_nesting_child_group_id` (`child_group_id`),
  KEY `FK_civicrm_group_nesting_parent_group_id` (`parent_group_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;

ALTER TABLE `civicrm_group_nesting`
  ADD CONSTRAINT `FK_civicrm_group_nesting_child_group_id` FOREIGN KEY (`child_group_id`) REFERENCES `civicrm_group` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `FK_civicrm_group_nesting_parent_group_id` FOREIGN KEY (`parent_group_id`) REFERENCES `civicrm_group` (`id`) ON DELETE CASCADE;

the problem was with
Code: [Select]
ADD CONSTRAINT `FK_civicrm_group_nesting_child_group_id` FOREIGN KEY (`child_group_id`) REFERENCES `civicrm_group` (`id`) ON DELETE CASCADE . my table don't have ON DELETE CASCADE before.

any one who want's to fallow this procedure to resolve your error please note that make sure that you take the data backup.

Deepak Srivastava

  • Moderator
  • Ask me questions
  • *****
  • Posts: 677
  • Karma: 65
Re: unable to delete groups has parent
October 23, 2008, 01:35:41 pm
Thanks, fix has been added to upgrade script - rev: 17652
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • unable to delete groups has parent

This forum was archived on 2017-11-26.