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) »
  • 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
Pages: [1] 2

Author Topic: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"  (Read 3390 times)

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
August 06, 2011, 11:25:57 pm
I had trouble with this specific site upgrading from 3.3.6 directly to 3.4.5 so I did incremental upgrades all the way to 3.4.4 without issues. Now going from 3.4.4. to 3.4.5 I receive the following error:

Code: [Select]
Database Error Code: Column 'weight' cannot be null, 1048
Additional Details:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_option_value
  (option_group_id, is_default, is_active, name, value, label, weight)
VALUES
(@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @counter := @counter + 1),
(@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @counter := @counter + 1) [nativecode=1048 ** Column 'weight' cannot be null]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_option_value
  (option_group_id, is_default, is_active, name, value, label, weight)
VALUES
(@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @counter := @counter + 1),
(@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @counter := @counter + 1) [nativecode=1048 ** Column 'weight' cannot be null]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_option_value
  (option_group_id, is_default, is_active, name, value, label, weight)
VALUES
(@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @counter := @counter + 1),
(@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @counter := @counter + 1) [nativecode=1048 ** Column 'weight' cannot be null]"]
)

After restoring the db back to 3.4.4 backup, I have checked and confirmed that table civicrm_option_value contains no NULL values in the weight column.

Any other suggestions would be welcome.

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
August 08, 2011, 02:49:57 am
It's a bug in upgrade hence filed: http://issues.civicrm.org/jira/browse/CRM-8619

Kurund
Found this reply helpful? Support CiviCRM

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
August 08, 2011, 08:03:12 am
Thanks Kurund. Is there a recommended upgrade path at the moment, or do I need to wait for 3.4.6 release?

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
August 08, 2011, 10:03:24 am
For now you can get the patch from https://fisheye2.atlassian.com/changelog/CiviCRM?cs=35621 for 3.4.5

Kurund
Found this reply helpful? Support CiviCRM

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
August 08, 2011, 01:27:48 pm
I applied the patch, and now get the following error (I've replaced the actual database name with db_name):

Code: [Select]
Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`db_name`.`civicrm_option_value`, CONSTRAINT `FK_civicrm_option_value_option_group_id` FOREIGN KEY (`option_group_id`) REFERENCES `civicrm_option_group` (`id`) ON DELETE CASCADE), 1452
Additional Details:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_option_value
  (option_group_id, is_default, is_active, name, value, label, weight)
VALUES
(@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @weight := @languages_max_weight + 1),
(@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @weight := @languages_max_weight + 2) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db_name`.`civicrm_option_value`, CONSTRAINT `FK_civicrm_option_value_option_group_id` FOREIGN KEY (`option_group_id`) REFERENCES `civicrm_option_group` (`id`) ON DELETE CASCADE)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_option_value
  (option_group_id, is_default, is_active, name, value, label, weight)
VALUES
(@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @weight := @languages_max_weight + 1),
(@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @weight := @languages_max_weight + 2) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db_name`.`civicrm_option_value`, CONSTRAINT `FK_civicrm_option_value_option_group_id` FOREIGN KEY (`option_group_id`) REFERENCES `civicrm_option_group` (`id`) ON DELETE CASCADE)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_option_value
  (option_group_id, is_default, is_active, name, value, label, weight)
VALUES
(@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @weight := @languages_max_weight + 1),
(@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @weight := @languages_max_weight + 2) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db_name`.`civicrm_option_value`, CONSTRAINT `FK_civicrm_option_value_option_group_id` FOREIGN KEY (`option_group_id`) REFERENCES `civicrm_option_group` (`id`) ON DELETE CASCADE)]"]
)

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
August 09, 2011, 12:40:45 am
Just to confirm, did you rollback to 3.4.4 and then tried upgrade? You can replace existing "3.4.5.mysql.tpl" with below file http://svn.civicrm.org/civicrm/branches/v4.0/CRM/Upgrade/Incremental/sql/3.4.5.mysql.tpl

HTh
Kurund
Found this reply helpful? Support CiviCRM

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
August 09, 2011, 03:59:36 pm
Quote from: Kurund Jalmi on August 09, 2011, 12:40:45 am
Just to confirm, did you rollback to 3.4.4 and then tried upgrade?

Correct, I rolled back, even dropped all the tables then restored from backup to ensure I had nothing hanging loose.

Quote from: Kurund Jalmi on August 09, 2011, 12:40:45 am
You can replace existing "3.4.5.mysql.tpl" with below file http://svn.civicrm.org/civicrm/branches/v4.0/CRM/Upgrade/Incremental/sql/3.4.5.mysql.tpl

That file doesn't seem to have the same changes reflected as https://fisheye2.atlassian.com/changelog/CiviCRM?cs=35621

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
August 10, 2011, 03:19:57 am
Sorry check this file

Quote
http://svn.civicrm.org/civicrm/branches/v3.4/CRM/Upgrade/Incremental/sql/3.4.5.mysql.tpl

Kurund
Found this reply helpful? Support CiviCRM

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
August 10, 2011, 05:38:58 am
Quote from: Kurund Jalmi on August 10, 2011, 03:19:57 am
Sorry check this file

Quote
http://svn.civicrm.org/civicrm/branches/v3.4/CRM/Upgrade/Incremental/sql/3.4.5.mysql.tpl

Kurund

That again appears to be the same file as included with the 3.4.5 distribution.

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
August 11, 2011, 09:33:21 am
Quote
That again appears to be the same file as included with the 3.4.5 distribution.
Nope it's not, it contains code for collect weight calculation.

Kurund
Found this reply helpful? Support CiviCRM

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
August 11, 2011, 06:59:24 pm
Quote from: Kurund Jalmi on August 11, 2011, 09:33:21 am
Nope it's not, it contains code for collect weight calculation.

My mistake, I must have pulled a different file. This one has upgraded successfully to 3.4.5. Thank you for your guidance.

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
Now 4.0.4 > 4.0.5 upgrade fails with "Column 'weight' cannot be null, 1048"
September 04, 2011, 10:12:06 am
Getting the same error now on another site when upgrading from 4.0.4 to 4.0.5

Code: [Select]
Database Error Code: Column 'weight' cannot be null, 1048
Additional Details:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_option_value
  (option_group_id, is_default, is_active, name, value, label, weight)
VALUES
(@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @counter := @counter + 1),
(@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @counter := @counter + 1) [nativecode=1048 ** Column 'weight' cannot be null]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_option_value
  (option_group_id, is_default, is_active, name, value, label, weight)
VALUES
(@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @counter := @counter + 1),
(@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @counter := @counter + 1) [nativecode=1048 ** Column 'weight' cannot be null]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_option_value
  (option_group_id, is_default, is_active, name, value, label, weight)
VALUES
(@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @counter := @counter + 1),
(@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @counter := @counter + 1) [nativecode=1048 ** Column 'weight' cannot be null]"]
)

Same issue or do you want me to file it separately?

robinhood

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 6
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.56
  • PHP version: 5.3.5
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
September 05, 2011, 02:45:55 pm
I have to say that I am disappointed that this issue has been known for almost a month and yet the 3.4.5 upgrade is still offered to civicrm users.   I am now reinstalling from backup which will cost me some unnecessary hours.  I wish someone had marked this version as having an issue with upgrades.

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: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
September 05, 2011, 03:51:21 pm

doing a point release takes a fair amount of time and effort. This basically also translates into actual hours :) Many of us on the core team were slammed with consulting / civicon / sprints / training / travel / vacation (make your own excuse here) and hence the delay.

We hope to get a release out in the next few weeks. You can help other folks avoid disappointment by getting more involved and helping with the releases. Some good ideas to help out are on this blog post: http://civicrm.org/blogs/davem/marketing-civicrm

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

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
Re: 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"
September 05, 2011, 05:42:20 pm
In the meantime, is there a feasible workaround to this upgrade issue?

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • 3.4.4. > 3.4.5 upgrade fails with "Column 'weight' cannot be null, 1048"

This forum was archived on 2017-11-26.