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 »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Major issue with FK violation - from custom data
Pages: [1]

Author Topic: Major issue with FK violation - from custom data  (Read 883 times)

davesage

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 3
  • CiviCRM version: 3.4 & 4.1
  • CMS version: Joomla 1.5 & 2.5
  • MySQL version: 5.1
  • PHP version: 5.3
Major issue with FK violation - from custom data
July 12, 2011, 05:06:46 pm
Hi,

Having some major issues with a FK violation, tried to fix it in sql and broke it worse - dope.

The reason I'm posting is that I think the original cause was down to the fact that I created a custom data set 'used for' 'events' and then changed it to 'participants'.

The system let me do this so I added fields to it and then used them in a profile.

All was fine but then after registering a few people (the same number as there were events) I got the fk violation.

(DB Error: constraint violation
Error Details
Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`xxxxxxx`.`civicrm_value_event_extra_information_4`, CONSTRAINT `FK_civicrm_value_event_extra_inform_969dea7568e9a592` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_event` (`id`) ON), 1452)


 When I looked at the fk constraint in mysql it was linked to the events table not the participants table.

(I then tried to fix it the wrong way and really messed things up, ending up not being able to create any new profile fields)

Glad I've got some backups :-). Twas good to test them out in a real scenario - few.

Should the system allow this to happen? Should you be able to change the type of data the custom data is used for once created? I suspect it is only while there are no fields but still should it lock that field for editing or do an alter table to change the fk constraint?

I've reproduced the creating and changing of the used for selection in the 3.4 Joomla demo and it does allow me to change it while there are no fields. I can't see the database to see what it is doing though and I don't want to save this and corrupt the demo site.

Any thoughts would be great.

I certainly won't be changing this field in the future.

Cheers,

Dave

davesage

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 3
  • CiviCRM version: 3.4 & 4.1
  • CMS version: Joomla 1.5 & 2.5
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Major issue with FK violation - from custom data
July 14, 2011, 09:10:16 am
Can anyone comment on expected behaviour? Should I raise it on the issue tracker?

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Major issue with FK violation - from custom data
July 14, 2011, 11:08:15 am
Looks like a regression bug. I've reopened the relevant issue at: http://issues.civicrm.org/jira/browse/CRM-5736 If you have resources to look into a fix / patch  - that would be great.
Protect your investment in CiviCRM by  becoming a Member!

davesage

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 3
  • CiviCRM version: 3.4 & 4.1
  • CMS version: Joomla 1.5 & 2.5
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Major issue with FK violation - from custom data
July 14, 2011, 11:58:20 am
Thanks Dave, looking at that issue it des look exactly the same.

Cheers,

Dave

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Major issue with FK violation - from custom data

This forum was archived on 2017-11-26.