Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.7
-
Fix Version/s: 1.8
-
Component/s: Core CiviCRM
-
Labels:None
Description
Maybe after deleting some groups or tags, a certain user profile (defined by excluding a certain tag ID) sees a backtrace and an SQL error, showing empty OR clauses. Any ideas? Donald A. Lobo has access to our server.
Backtrace:
/home/crm/crm3/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 147
, handle,
/home/crm/crm3/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 901
/home/crm/crm3/sites/all/modules/civicrm/packages/DB.php, PEAR_Error, 888
/home/crm/crm3/sites/all/modules/civicrm/packages/PEAR.php, DB_Error, 563
/home/crm/crm3/sites/all/modules/civicrm/packages/DB/common.php, raiseError, 1849
/home/crm/crm3/sites/all/modules/civicrm/packages/DB/mysql.php, raiseError, 894
/home/crm/crm3/sites/all/modules/civicrm/packages/DB/mysql.php, mysqlRaiseError, 324
/home/crm/crm3/sites/all/modules/civicrm/packages/DB/common.php, simpleQuery, 1162
/home/crm/crm3/sites/all/modules/civicrm/packages/DB/DataObject.php, query, 2344
/home/crm/crm3/sites/all/modules/civicrm/packages/DB/DataObject.php, _query, 1566
/home/crm/crm3/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 659
/home/crm/crm3/sites/all/modules/civicrm/CRM/Contact/BAO/GroupContact.php, executeQuery, 370
/home/crm/crm3/sites/all/modules/civicrm/CRM/Contact/BAO/GroupContact.php, getContactGroup, 112
/home/crm/crm3/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php, getValues, 1003
/home/crm/crm3/sites/all/modules/civicrm/CRM/Contact/Page/View/Tabbed.php, retrieve, 112
/home/crm/crm3/sites/all/modules/civicrm/CRM/Contact/Page/View/Tabbed.php, view, 76
/home/crm/crm3/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 357
/home/crm/crm3/sites/all/modules/civicrm/CRM/Core/Invoke.php, contact, 82
/home/crm/crm3/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 288
, civicrm_invoke,
/home/crm/crm3/includes/menu.inc, call_user_func_array, 418
/home/crm/crm3/index.php, menu_execute_active_handler, 15
Error details:
Error Details:
Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -2
[message] => DB Error: syntax error
[mode] => 16
[debug_info] => SELECT
civicrm_group_contact.id as civicrm_group_contact_id,
civicrm_group.title as group_title,
civicrm_group.visibility as visibility,
civicrm_group_contact.status as status,
civicrm_group.id as group_id,
civicrm_subscription_history.date as date,
civicrm_subscription_history.method as method FROM civicrm_contact contact_a LEFT JOIN civicrm_individual ON (contact_a.id = civicrm_individual.contact_id) LEFT JOIN civicrm_location ON (civicrm_location.entity_table = 'civicrm_contact' AND
contact_a.id = civicrm_location.entity_id AND civicrm_location.is_primary = 1) LEFT JOIN civicrm_address ON civicrm_location.id = civicrm_address.location_id LEFT JOIN civicrm_state_province ON civicrm_address.state_province_id = civicrm_state_province.id LEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id LEFT JOIN civicrm_email ON (civicrm_location.id = civicrm_email.location_id AND civicrm_email.is_primary = 1) LEFT JOIN civicrm_phone ON (civicrm_location.id = civicrm_phone.location_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_im ON (civicrm_location.id = civicrm_im.location_id AND civicrm_im.is_primary = 1) LEFT JOIN civicrm_group_contact ON contact_a.id = civicrm_group_contact.contact_id LEFT JOIN civicrm_group ON civicrm_group.id = civicrm_group_contact.group_id LEFT JOIN civicrm_subscription_history
ON civicrm_group_contact.contact_id = civicrm_subscription_history.contact_id
AND civicrm_group_contact.group_id = civicrm_subscription_history.group_id LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-11,31,12,41,13` ON ( `civicrm_entity_tag-11,31,12,41,13`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-11,31,12,41,13`.entity_id ) LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-19` ON ( `civicrm_entity_tag-19`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-19`.entity_id ) LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-1` ON ( `civicrm_entity_tag-1`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-1`.entity_id ) LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-48` ON ( `civicrm_entity_tag-48`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-48`.entity_id ) LEFT JOIN civicrm_option_group option_group_gender ON (option_group_gender.name = 'gender') LEFT JOIN civicrm_option_value gender ON (civicrm_individual.gender_id = gender.value AND option_group_gender.id = gender.option_group_id) WHERE contact_a.id = 1450 AND civicrm_group.is_active = 1 AND civicrm_group_contact.status = 'Added' AND ( ( civicrm_group_contact.group_id IN (11, 15, 13, 14, 5, 1, 2, 7, 8, 6, 12, 9, 3 ) AND civicrm_group_contact.status = 'Added' ) OR ( `civicrm_entity_tag-11,31,12,41,13`.tag_id IN (11,31,12,41,13) ) OR OR ( `civicrm_entity_tag-19`.tag_id IN (19) ) OR ( `civicrm_entity_tag-1`.tag_id IN (1) ) OR ( ( `civicrm_entity_tag-48`.tag_id != (48) AND contact_a.contact_type IN ('Individual') ) ) ) ORDER BY civicrm_group.title LIMIT 0, 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 'OR ( `civicrm_entity_tag-19`.tag_id IN (19) ) OR ( `civicrm_e]
[type] => DB_Error
[user_info] => SELECT
civicrm_group_contact.id as civicrm_group_contact_id,
civicrm_group.title as group_title,
civicrm_group.visibility as visibility,
civicrm_group_contact.status as status,
civicrm_group.id as group_id,
civicrm_subscription_history.date as date,
civicrm_subscription_history.method as method FROM civicrm_contact contact_a LEFT JOIN civicrm_individual ON (contact_a.id = civicrm_individual.contact_id) LEFT JOIN civicrm_location ON (civicrm_location.entity_table = 'civicrm_contact' AND
contact_a.id = civicrm_location.entity_id AND civicrm_location.is_primary = 1) LEFT JOIN civicrm_address ON civicrm_location.id = civicrm_address.location_id LEFT JOIN civicrm_state_province ON civicrm_address.state_province_id = civicrm_state_province.id LEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id LEFT JOIN civicrm_email ON (civicrm_location.id = civicrm_email.location_id AND civicrm_email.is_primary = 1) LEFT JOIN civicrm_phone ON (civicrm_location.id = civicrm_phone.location_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_im ON (civicrm_location.id = civicrm_im.location_id AND civicrm_im.is_primary = 1) LEFT JOIN civicrm_group_contact ON contact_a.id = civicrm_group_contact.contact_id LEFT JOIN civicrm_group ON civicrm_group.id = civicrm_group_contact.group_id LEFT JOIN civicrm_subscription_history
ON civicrm_group_contact.contact_id = civicrm_subscription_history.contact_id
AND civicrm_group_contact.group_id = civicrm_subscription_history.group_id LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-11,31,12,41,13` ON ( `civicrm_entity_tag-11,31,12,41,13`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-11,31,12,41,13`.entity_id ) LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-19` ON ( `civicrm_entity_tag-19`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-19`.entity_id ) LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-1` ON ( `civicrm_entity_tag-1`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-1`.entity_id ) LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-48` ON ( `civicrm_entity_tag-48`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-48`.entity_id ) LEFT JOIN civicrm_option_group option_group_gender ON (option_group_gender.name = 'gender') LEFT JOIN civicrm_option_value gender ON (civicrm_individual.gender_id = gender.value AND option_group_gender.id = gender.option_group_id) WHERE contact_a.id = 1450 AND civicrm_group.is_active = 1 AND civicrm_group_contact.status = 'Added' AND ( ( civicrm_group_contact.group_id IN (11, 15, 13, 14, 5, 1, 2, 7, 8, 6, 12, 9, 3 ) AND civicrm_group_contact.status = 'Added' ) OR ( `civicrm_entity_tag-11,31,12,41,13`.tag_id IN (11,31,12,41,13) ) OR OR ( `civicrm_entity_tag-19`.tag_id IN (19) ) OR ( `civicrm_entity_tag-1`.tag_id IN (1) ) OR ( ( `civicrm_entity_tag-48`.tag_id != (48) AND contact_a.contact_type IN ('Individual') ) ) ) ORDER BY civicrm_group.title LIMIT 0, 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 'OR ( `civicrm_entity_tag-19`.tag_id IN (19) ) OR ( `civicrm_e]
[to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT
civicrm_group_contact.id as civicrm_group_contact_id,
civicrm_group.title as group_title,
civicrm_group.visibility as visibility,
civicrm_group_contact.status as status,
civicrm_group.id as group_id,
civicrm_subscription_history.date as date,
civicrm_subscription_history.method as method FROM civicrm_contact contact_a LEFT JOIN civicrm_individual ON (contact_a.id = civicrm_individual.contact_id) LEFT JOIN civicrm_location ON (civicrm_location.entity_table = 'civicrm_contact' AND
contact_a.id = civicrm_location.entity_id AND civicrm_location.is_primary = 1) LEFT JOIN civicrm_address ON civicrm_location.id = civicrm_address.location_id LEFT JOIN civicrm_state_province ON civicrm_address.state_province_id = civicrm_state_province.id LEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id LEFT JOIN civicrm_email ON (civicrm_location.id = civicrm_email.location_id AND civicrm_email.is_primary = 1) LEFT JOIN civicrm_phone ON (civicrm_location.id = civicrm_phone.location_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_im ON (civicrm_location.id = civicrm_im.location_id AND civicrm_im.is_primary = 1) LEFT JOIN civicrm_group_contact ON contact_a.id = civicrm_group_contact.contact_id LEFT JOIN civicrm_group ON civicrm_group.id = civicrm_group_contact.group_id LEFT JOIN civicrm_subscription_history
ON civicrm_group_contact.contact_id = civicrm_subscription_history.contact_id
AND civicrm_group_contact.group_id = civicrm_subscription_history.group_id LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-11,31,12,41,13` ON ( `civicrm_entity_tag-11,31,12,41,13`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-11,31,12,41,13`.entity_id ) LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-19` ON ( `civicrm_entity_tag-19`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-19`.entity_id ) LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-1` ON ( `civicrm_entity_tag-1`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-1`.entity_id ) LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-48` ON ( `civicrm_entity_tag-48`.entity_table = 'civicrm_contact' AND
contact_a.id = `civicrm_entity_tag-48`.entity_id ) LEFT JOIN civicrm_option_group option_group_gender ON (option_group_gender.name = 'gender') LEFT JOIN civicrm_option_value gender ON (civicrm_individual.gender_id = gender.value AND option_group_gender.id = gender.option_group_id) WHERE contact_a.id = 1450 AND civicrm_group.is_active = 1 AND civicrm_group_contact.status = 'Added' AND ( ( civicrm_group_contact.group_id IN (11, 15, 13, 14, 5, 1, 2, 7, 8, 6, 12, 9, 3 ) AND civicrm_group_contact.status = 'Added' ) OR ( `civicrm_entity_tag-11,31,12,41,13`.tag_id IN (11,31,12,41,13) ) OR OR ( `civicrm_entity_tag-19`.tag_id IN (19) ) OR ( `civicrm_entity_tag-1`.tag_id IN (1) ) OR ( ( `civicrm_entity_tag-48`.tag_id != (48) AND contact_a.contact_type IN ('Individual') ) ) ) ORDER BY civicrm_group.title LIMIT 0, 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 'OR ( `civicrm_entity_tag-19`.tag_id IN (19) ) OR ( `civicrm_e]"]
)