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) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 3.1 Release Testing »
  • Price Set Deletion
Pages: [1]

Author Topic: Price Set Deletion  (Read 2270 times)

orthodoxkohen

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 2
Price Set Deletion
December 09, 2009, 04:23:34 pm
While Deleting Price Set I got this error.

Code: [Select]

unrecoverable error
    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 (`kencost_yeslive/civicrm_price_set_entity`, CONSTRAINT `FK_civicrm_price_set_entity_price_set_id` FOREIGN KEY (`price_set_id`) REFERENCES `civicrm_price_set` (`id`)), 1451

    Return to home page.

Error Details:

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

    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => DELETE FROM civicrm_price_set  WHERE (  civicrm_price_set.id = 1 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`kencost_yeslive/civicrm_price_set_entity`, CONSTRAINT `FK_civicrm_price_set_entity_price_set_id` FOREIGN KEY (`price_set_id`) REFERENCES `civicrm_price_set` (`id`))]
    [type] => DB_Error
    [user_info] => DELETE FROM civicrm_price_set  WHERE (  civicrm_price_set.id = 1 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`kencost_yeslive/civicrm_price_set_entity`, CONSTRAINT `FK_civicrm_price_set_entity_price_set_id` FOREIGN KEY (`price_set_id`) REFERENCES `civicrm_price_set` (`id`))]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="DELETE FROM civicrm_price_set  WHERE (  civicrm_price_set.id = 1 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`kencost_yeslive/civicrm_price_set_entity`, CONSTRAINT `FK_civicrm_price_set_entity_price_set_id` FOREIGN KEY (`price_set_id`) REFERENCES `civicrm_price_set` (`id`))]"]
)
[/code]

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Price Set Deletion
December 10, 2009, 02:48:12 am
I suspect this price set was used by some event and that event is get deleted.

So to tackle w/ such use case in future, filed issue is here : http://issues.civicrm.org/jira/browse/CRM-5526

In your cases :
Code: [Select]
          DELETE  entity.*
            FROM  civicrm_price_set_entity entity
       LEFT JOIN  civicrm_event event ON ( event.id = entity.entity_id and entity.entity_table = 'civicrm_event' )
           WHERE  event.id IS NULL;
fire this query on civicrm db witch will cleanup civicrm_price_set_entity table and then you can delete your price set.

( Caveat : Make sure to take database backup before executing query. )


thanks,
kiran
You Are Designed To Choose... Defined By Choice.

orthodoxkohen

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 2
Re: Price Set Deletion
December 12, 2009, 03:52:14 pm
Thanks Kiran.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 3.1 Release Testing »
  • Price Set Deletion

This forum was archived on 2017-11-26.