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 »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • DB Error: constraint violation during installation
Pages: [1]

Author Topic: DB Error: constraint violation during installation  (Read 3963 times)

druderman

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4.1+
  • CMS version: Drupal 7
  • MySQL version: 5.0.77 and 5.1
  • PHP version: 5.2.13
DB Error: constraint violation during installation
March 27, 2012, 11:26:39 am
I just did a new install of Drupal 7 and CiviCRM 4.1.1 and at the end I get an error.

There's alot of output, so I will summarize with a short clip.
Also, I can see that now the civicrm_option_value table is empty and civicrm_component table has a value for each CiviCRM component.


DB_Error Object
(
    [error_message_prefix] =>
    [mode] => 1
    [level] => 1024
   
Code: [Select]
=> -3
    [message] => DB Error: constraint violation
    [userinfo] => INSERT INTO
   `civicrm_option_value` (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
   (@option_group_id_pcm, 'Phone', 1, NULL, NULL, 0, NULL, 1, NULL, 0, 0, 1, NULL, NULL),
   (@option_group_id_pcm, 'Email', 2, NULL, NULL, 0, NULL, 2, NULL, 0, 0, 1, NULL, NULL),
   (@option_group_id_pcm, 'Postal Mail', 3, NULL, NULL, 0, NULL, 3, NULL, 0, 0, 1, NULL, NULL),
   (@option_group_id_pcm, 'SMS', 4, NULL, NULL, 0, NULL, 4, NULL, 0, 0, 1, NULL, NULL),
   (@option_group_id_pcm, 'Fax', 5, NULL, NULL, 0, NULL, 5, NULL, 0, 0, 1, NULL, NULL),
 
   (@option_group_id_act, 'Meeting',                            1, 'Meeting', NULL, 0, NULL, 1, NULL,                                                                        0, 1, 1, NULL, NULL),
   (@option_group_id_act, 'Phone Call',                         2, 'Phone Call',          NULL, 0, NULL, 2, NULL,                                                          0, 1, 1, NULL, NULL),
   (@option_group_id_act, 'Email',                              3, 'Email',               NULL, 1, NULL, 3, 'Email sent.',                                                          0, 1, 1, NULL, NULL),
   (@option_group_id_act, 'Text Message (SMS)',                 4, 'SMS',                 NULL, 1, NULL, 4, 'Text message (SMS) sent.',                                             0, 1, 1, NULL, NULL),

...

Lotsa other messages here of a similar type.
...

[4] => 1452 ** Cannot add or update a child row: a foreign key constraint fails (`crm_civicrm/civicrm_option_value`, CONSTRAINT `FK_civicrm_option_value_component_id` FOREIGN KEY (`component_id`) REFERENCES `civicrm_component` (`id`))
                        )
...

Any ideas?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: DB Error: constraint violation during installation
March 27, 2012, 12:15:01 pm
What is your MySQL version?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

druderman

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4.1+
  • CMS version: Drupal 7
  • MySQL version: 5.0.77 and 5.1
  • PHP version: 5.2.13
Re: DB Error: constraint violation during installation
March 27, 2012, 12:23:29 pm
MySQL version 5.0.77

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: DB Error: constraint violation during installation
March 27, 2012, 12:26:46 pm
Please see http://civicrm.org/aboutcivicrm

CiviCRM requires:

PHP 5.2.1+ (PHP 5.3 is supported starting with CiviCRM 3.2) with PCRE support
MySQL 5.1.x+ with InnoDB support
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

druderman

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4.1+
  • CMS version: Drupal 7
  • MySQL version: 5.0.77 and 5.1
  • PHP version: 5.2.13
Re: DB Error: constraint violation during installation
March 27, 2012, 12:33:20 pm
Thanks. I do see that now in the requirements, but I can't figure out why I have this working on another server running MySQL 5.0.95 as a new install.

The only difference is I also loaded the sample data when I did that install which was CiviCRM version 4.1.0.



Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: DB Error: constraint violation during installation
March 27, 2012, 12:36:07 pm
Certainly not every operation requires MySQL 5.1, but some do. Perhaps loading the sample data allows CiviCRM to skip a later initialization step. Your first installed skipped it, because it was done automatically by the sample data, and the second install choked on it.

I'm just guessing.

Bottom line is that even if the first install is working now, there is no guarantee whatsoever that it will continue to work and will support all functions in CiviCRM. The odds are that eventually something will not work.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

druderman

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4.1+
  • CMS version: Drupal 7
  • MySQL version: 5.0.77 and 5.1
  • PHP version: 5.2.13
Re: DB Error: constraint violation during installation
March 27, 2012, 12:37:31 pm
I understand. Now I have to see if our IT dept has MySQL 5.1+ running somewhere.

Thanks!

mtorgler

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.0
  • CMS version: Drupal 7.8
  • MySQL version: 5.0.91-log
  • PHP version: 5.2.17
Re: DB Error: constraint violation during installation
April 10, 2012, 10:52:15 am
I'm in a similar situation, but using a hosting service

Is there a version of CiviCRM stable with MySQL 5.0.92 and Drupal 7?

druderman

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4.1+
  • CMS version: Drupal 7
  • MySQL version: 5.0.77 and 5.1
  • PHP version: 5.2.13
Re: DB Error: constraint violation during installation
April 10, 2012, 11:16:09 am
For development, I do accidentally have it working under mysql 5.0 on one server, but given that mysql 5.1 support is required, there will eventually be some functionality that you hit or that is utilized in a future update that will attempt to use features of 5.1. At that point, you will be sorry.

When I looked into this recently, I believe I saw a prior version of CiviCRM didn't have this requirement, but you won't have an upgrade path.

« Last Edit: April 10, 2012, 11:17:44 am by druderman »

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: DB Error: constraint violation during installation
April 22, 2013, 05:56:02 am
I get this error (the one in the first post in the thread) installing civicrm 4.3.1 on a new Drupal 7.22 installation (with commerce, panels, webform and views installed prior to civicrm).

Instead of failing with insert into civicrm_option_value it fails with:
[userinfo] => INSERT INTO `civicrm_entity_financial_account`
but everything else looks pretty much the same as described by druderman.

My PHP version is 5.3.10, MySql is version 5.5.29.

I don't really know what to do from here - I've tried simply deleting the database and install again, but it fails with the same error everytime.
 

petbos157

  • I’m new here
  • *
  • Posts: 26
  • Karma: 2
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7
  • MySQL version: 5.1.71
  • PHP version: 5.3.3
Re: DB Error: constraint violation during installation
April 23, 2013, 06:19:02 am
I've exactly tesame error as andersiversen.
Install civicrm 4.3.0 on a new drupal 7.22 installation.

In attachment the logfile with the error civicrm returns.
« Last Edit: April 23, 2013, 06:45:41 am by petbos157 »

petbos157

  • I’m new here
  • *
  • Posts: 26
  • Karma: 2
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7
  • MySQL version: 5.1.71
  • PHP version: 5.3.3
Re: DB Error: constraint violation during installation
April 23, 2013, 07:50:22 am
Selecting the default language (englisch) during the install procedure will solve the problem (for me).

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: DB Error: constraint violation during installation
April 25, 2013, 07:02:28 am
Thanks for sharing your solution petbos - that did the trick for me as well.
Also, when failing, I  untar'ed the localization files before install - so I didn't do that, and didn't touch the language dropdown on the install page and then it worked.
Well it almost worked - because the installer didn't finished and I got a WSOD. So I looked in the server's error log and found out that the install script exhausted the memory allowed to be used by PHP. I bumped it up to 160M - that wasn't enough, so I bumped it to 256M and it finally worked (in case anyone reading are wondering: that's in php.ini - the memory_limit setting).
 


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • DB Error: constraint violation during installation

This forum was archived on 2017-11-26.