Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 1.6
-
Fix Version/s: 1.6
-
Component/s: None
-
Labels:None
Description
I just tested an upgrade from 1.5 to 1.6.8022 and have found that any search involving a smart group is giving a database error.
"Database Error Code: Unknown table 'civicrm_group_contact' in where clause, 1109"
I found that the issue was due to the query generated by CRM/Contact/BAO/Query.php in the 'else' clause of the "if ( $config->mysqlVersion >= 4.1 )" test on line 1689 (this is also about the only place that mysql 4.0 is special cased in the project).
I changed the WHERE parameters to use the table alias $gcTable = "`civicrm_group_contact-" .implode( ',', array_keys($value) ) ."`"; instead of "civicrm_group_contact" to get rid of the error and everything now seems ok.
This is pretty easy to reproduce, just change the config to specify mysql 4.0 and do a search involving a smart group to exercise this code path.