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 (Moderator: Dave Greenberg) »
  • Custom data and relationships for contact IDs that don't exist?
Pages: [1]

Author Topic: Custom data and relationships for contact IDs that don't exist?  (Read 992 times)

ncameron

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.4.7
  • CMS version: Drupal 6
  • MySQL version: ?
  • PHP version: 5.3
Custom data and relationships for contact IDs that don't exist?
October 25, 2013, 11:18:42 am
Hi there,

We've got an interesting issue on our drupal 6 / Civi 3.4.7 setup.

We're seeing custom data and relationships for contact ID's that have yet been created:

Attachment one: Most recent ID is 14330

Attachment two: Relationship data for 14661, 14659 - these user IDs do not exist yet!

Attachment three: Custom field data for User IDs that don't exist yet

Would love to hear any thoughts on what might cause this.

This is causing issues in that new contacts get random profiles assigned to them.

Happy to supply any more info that would help.

Thanks
Neil

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Custom data and relationships for contact IDs that don't exist?
October 27, 2013, 11:36:58 pm
What do you see if you look at contact 14661 in CiviCRM?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: Custom data and relationships for contact IDs that don't exist?
October 28, 2013, 12:36:21 am
It is an unusual problem to have.  It suggests legacy data in the database. 

What is the history to this problem?  Eg. Has it just appeared? Have you personally maintained the CiviCRM installation since its first inception? If not, are you in contact with previous maintainers?  Were there any data imports at the beginning or at any time since? Have all database changes been through the UI or at some stage has someone had direct access to the MySQL database?  etc.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Custom data and relationships for contact IDs that don't exist?
October 28, 2013, 12:43:15 am
Not sure what your CiviCRM level of expertise is so this might be a stupid question....forgive me if it is  ;D
Is your custom group set for only Indivduals or for all contacts? Could you have created a contact without noticing? For example, if you enter an employer in a contact form, the relationship 'Employer/employee' is created automatically, and if the company does not exist a contact will be created for the company. But if you are an experienced CiviCRM user you already know this
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

ncameron

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.4.7
  • CMS version: Drupal 6
  • MySQL version: ?
  • PHP version: 5.3
Re: Custom data and relationships for contact IDs that don't exist?
October 28, 2013, 05:36:47 am
Hi All,

Thanks so much for your time. Here are some answers to questions:

Quote
Not sure what your CiviCRM level of expertise
I'd give myself 6/10, I know the fundamentals and very experienced with drupal

Quote
Is your custom group set for only Indivduals or for all contacts?
See attachment, most are against certain contact types, but technical interests, which only apply to Indivduals are set to apply to all.

Quote
Could you have created a contact without noticing? For example, if you enter an employer in a contact form, the relationship 'Employer/employee' is created automatically, and if the company does not exist a contact will be created for the company.
I don't think we have anything like that happening. Every time a drupal user registers we create a contact, but only saving first name, last name, address and company name (which doesn't create a organisation). Even if this were happening, the most recent contact ID in the contact table and the most recent contact ID in the relationships table would be the same right? You wouldn't have relationship data for contact IDs that "don't exist yet"

Quote
What is the history to this problem?  Eg. Has it just appeared? Have you personally maintained the CiviCRM installation since its first inception? If not, are you in contact with previous maintainers?  Were there any data imports at the beginning or at any time since? Have all database changes been through the UI or at some stage has someone had direct access to the MySQL database?
We noticed it around 3 weeks ago, going back comparting drupal users to civi it looks like it has been happening for around 12 weeks. We develop and maintain the site. We did a number of imports in 2011 / 2012 but only started noticing issues now. No one has done any direct DB changes.

Quote
What do you see if you look at contact 14661 in CiviCRM?
That contact doesn't exist! The most recent is 14330. That's what makes it so odd!

Thanks everyone for your continued help, would appreciate any more thoughts. Will do a write up of the symptoms, cause and fix once this is resolved.



Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Custom data and relationships for contact IDs that don't exist?
October 28, 2013, 06:23:10 am
Weird!! I would imagine you would get all sort of DB errors if the record does not exist in civicrm_contact?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

ncameron

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.4.7
  • CMS version: Drupal 6
  • MySQL version: ?
  • PHP version: 5.3
Re: Custom data and relationships for contact IDs that don't exist?
October 28, 2013, 06:26:00 am
Quote from: Erik Hommel on October 28, 2013, 06:23:10 am
Weird!! I would imagine you would get all sort of DB errors if the record does not exist in civicrm_contact?

Actually not really, because that contact is never referred to, because it doesn't exist...

What do get though is random profile info and relationships applied to new contacts because they are using IDs which don't exist in the contact table but do exist in the relationship and custom data tables

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Custom data and relationships for contact IDs that don't exist?
October 28, 2013, 06:36:30 am
Yeah, that is true. What CiviCRM version are you on?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

ncameron

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.4.7
  • CMS version: Drupal 6
  • MySQL version: ?
  • PHP version: 5.3
Re: Custom data and relationships for contact IDs that don't exist?
October 28, 2013, 07:23:02 am
Quote from: Erik Hommel on October 28, 2013, 06:36:30 am
Yeah, that is true. What CiviCRM version are you on?

3.4.7 + D6

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: Custom data and relationships for contact IDs that don't exist?
October 28, 2013, 04:02:59 pm
There are two parts to the problem it seems to me: "How did this happen?"; "How will I deal with it?"

How did it happen?

Do you have logging enabled for your site?  If so, you should be able to find out when and who created the information. (Look in the log_civicrm_relationship table and the log_civicrm_value_ ... table for you custom_fields - I presume you have scoured the DB thoroughly and determined these are the only rogue entries.)  If logging isn't enabled, turn it on.

Is the relationship and custom_field data for the 'non-existent' contacts static or are there more entries appearing? If it is the former and I hadn't found anything in the log tables I would stop trying to answer "how did this happen" at this stage and instead answer "how will I deal with it"

"How will I deal with it?"

I'm not a developer, so you should wait for a second opinion, but, whether or not I knew where the data had come from, I would make a copy of the rogue entries, delete them from the database and carefully monitor the situation from now on.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Custom data and relationships for contact IDs that don't exist?
October 29, 2013, 01:43:13 am
Quote
I'm not a developer, so you should wait for a second opinion, but, whether or not I knew where the data had come from, I would make a copy of the rogue entries, delete them from the database and carefully monitor the situation from now on.

That makes sense Joanne. Also, is there any modification or upgrades that have happened in the period when this thing started, either on CiviCRM or on Drupal?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Custom data and relationships for contact IDs that don't exist?
October 29, 2013, 12:06:50 pm
or a sql query to create relationships some time in the dim distant past?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Custom data and relationships for contact IDs that don't exist?
October 29, 2013, 12:22:21 pm
You should make sure your tables are INNODB & the Foreign key constraints exist on the contact id fields

NB - you might modify your original post to say contact_ids instead of user_ids as appropriate as it is a bit confusing
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Custom data and relationships for contact IDs that don't exist?

This forum was archived on 2017-11-26.