Answers.Body: <p>I see where the problem is happening and I have a solution, but from the CSV you're sharing, I can't see <em>why</em> the problem is happening.</p>
  
  <p>Next time, before upgrading, go to your CiviCRM root and then open <code>CRM/Upgrade/Incremental/php/FourFour.php</code>.  Around line 543 will be a function called <code>activityContacts()</code>.  CiviCRM changes how activity contacts are stored in version 4.4+, and this function is meant to facilitate that.</p>
  
  <p>The first several lines are meant to look up the option value records labeled "Activity Source", "Activity Assignees" and "Activity Targets" and set them to be "reserved", so they can't be changed.  Based on the SQL in your error, it's not finding "Activity Assignees" - but I don't understand why, your CSV looks fine.</p>
  
  <p>Regardless - you can fix this by ignoring the lookups and manually change the SQL query to use the values that I can see in your CSV file.</p>
  
  <p>Change these lines:</p>
  
  <pre><code>    $query = " 
  UPDATE civicrm_option_value
  SET    is_reserved = 1
  WHERE  option_group_id = {$optionGroupID} AND value IN ($ovValues)";
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>    $query = " 
  UPDATE civicrm_option_value
  SET    is_reserved = 1
  WHERE  option_group_id = {$optionGroupID} AND value IN (1, 2, 3)";
  </code></pre>
  
  <p>Re-run the upgrade and you should get past that error.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-22T15:09:11.313Z
Answers.Text: Thank you, that change did help and as you said I've been looking for what is wrong with the database all this time and couldn't find anything at all(also updated the MySQL and Joomla versions)
Answers.UserDisplayName: Guillermo Ricci
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-21T13:50:32.740Z
Answers.LastActivityDate: 2016-12-21T13:50:32.740Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>The upgrade process keeps failing, I even tried doing upgrades version after version but always when getting to 4.4 it fails when we get the 4.4 alpha1 update, the error that shows is:</p>
  
  <pre><code>[Error: Consolidate activity contacts]
  Error Field Error Value
  Type    DB_Error
  Code    -2
  Message DB Error: syntax error
  Mode    16
  UserInfo    UPDATE civicrm_option_value SET is_reserved = 1 WHERE option_group_id = 62 AND value IN (2, , 3) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 3)' at line 3]
  DebugInfo   UPDATE civicrm_option_value SET is_reserved = 1 WHERE option_group_id = 62 AND value IN (2, , 3) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 3)' at line 3]
  PEAR_Exception: DB Error: syntax error in unknown on line unknown
  - DB_Error: DB Error: syntax error in unknown on line unknown
  </code></pre>
  
  <p>I keep looking for the error but can't find it, does anyone knows a better way to verify it? Or if you know what error is on this table? (I only left the main columns and deleted the rest)</p>
  
  <p><a href="https://dl.dropboxusercontent.com/u/92433965/civicrm_option_value.csv" rel="nofollow noreferrer">https://dl.dropboxusercontent.com/u/92433965/civicrm_option_value.csv</a></p>
  
  <p>Server 1 
  PHP:5.6.8
  MySQL:5.6.24</p>
  
  <p>Server 2
  PHP:5.6.28-0+deb8u1
  MySQL:5.5.53-0+deb8u1</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-20T00:27:26.917Z
Comments.Text: Have you checked to make sure your server has a compatible version of PHP?
Comments.UserDisplayName: Christia
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-21T01:36:18.557Z
Comments.Text: Yes, compatible PHP version checked, even tried in 2 different servers thinking that was the issue and a XAMPP server and the same happens
Comments.UserDisplayName: Guillermo Ricci
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-21T01:49:48.990Z
Comments.Text: Can you update your post with what version of MySQL and Joomla you are running? `mysql --version`
Comments.UserDisplayName: Christia
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-21T21:22:28.373Z
Comments.Text: https://wiki.civicrm.org/confluence/display/CRMDOC/Upgrading+CiviCRM+for+Joomla
  Joomla version needs to be higher than 3.x in order to upgrade and run CiviCRM 4.x versions and MySQL version must be 5.1.x or higher.
Comments.UserDisplayName: Christia
Tags: <contacts><joomla><upgrade>
Title: Upgrade from 4.2.7 to 4.7.13 fails during DB 4.4alpha1 update Joomla
ThreadText: # Upgrade from 4.2.7 to 4.7.13 fails during DB 4.4alpha1 update Joomla
  
  (Asked by: username_0 on 2016-11-27)
  
  The upgrade process keeps failing, I even tried doing upgrades version after version but always when getting to 4.4 it fails when we get the 4.4 alpha1 update, the error that shows is:
  [Error: Consolidate activity contacts]
  Error Field Error Value
  Type    DB_Error
  Code    -2
  Message DB Error: syntax error
  Mode    16
  UserInfo    UPDATE civicrm_option_value SET is_reserved = 1 WHERE option_group_id = 62 AND value IN (2, , 3) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 3)' at line 3]
  DebugInfo   UPDATE civicrm_option_value SET is_reserved = 1 WHERE option_group_id = 62 AND value IN (2, , 3) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 3)' at line 3]
  PEAR_Exception: DB Error: syntax error in unknown on line unknown
  - DB_Error: DB Error: syntax error in unknown on line unknown
  
  I keep looking for the error but can't find it, does anyone knows a better way to verify it? Or if you know what error is on this table? (I only left the main columns and deleted the rest)
  https://dl.dropboxusercontent.com/u/92433965/civicrm_option_value.csv
  Server 1 
  PHP:5.6.8
  MySQL:5.6.24
  Server 2
  PHP:5.6.28-0+deb8u1
  MySQL:5.5.53-0+deb8u1
  
  **Tags:** contacts, joomla, upgrade
  
  > **Comments:**
  > **username_1**: Have you checked to make sure your server has a compatible version of PHP?  
  > **username_0**: Yes, compatible PHP version checked, even tried in 2 different servers thinking that was the issue and a XAMPP server and the same happens  
  > **username_1**: Can you update your post with what version of MySQL and Joomla you are running? `mysql --version`  
  > **username_1**: https://wiki.civicrm.org/confluence/display/CRMDOC/Upgrading+CiviCRM+for+Joomla Joomla version needs to be higher than 3.x in order to upgrade and run CiviCRM 4.x versions and MySQL version must be 5.1.x or higher.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-12-21. Score: 0 | Accepted answer
  
  I see where the problem is happening and I have a solution, but from the CSV you're sharing, I can't see why the problem is happening.
  Next time, before upgrading, go to your CiviCRM root and then open CRM/Upgrade/Incremental/php/FourFour.php.  Around line 543 will be a function called activityContacts().  CiviCRM changes how activity contacts are stored in version 4.4+, and this function is meant to facilitate that.
  The first several lines are meant to look up the option value records labeled "Activity Source", "Activity Assignees" and "Activity Targets" and set them to be "reserved", so they can't be changed.  Based on the SQL in your error, it's not finding "Activity Assignees" - but I don't understand why, your CSV looks fine.
  Regardless - you can fix this by ignoring the lookups and manually change the SQL query to use the values that I can see in your CSV file.
  Change these lines:
      $query = " 
  UPDATE civicrm_option_value
  SET    is_reserved = 1
  WHERE  option_group_id = {$optionGroupID} AND value IN ($ovValues)";
  
  to this:
      $query = " 
  UPDATE civicrm_option_value
  SET    is_reserved = 1
  WHERE  option_group_id = {$optionGroupID} AND value IN (1, 2, 3)";
  
  Re-run the upgrade and you should get past that error.
  
  > **Comments:**
  > **username_0**: Thank you, that change did help and as you said I've been looking for what is wrong with the database all this time and couldn't find anything at all(also updated the MySQL and Joomla versions)  
  
  ---
  
  