Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-17201

DB Error: syntax error when rule 'impossibly' configured - form validation should prevent

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.6.8, 4.6.28
    • Fix Version/s: None
    • Component/s: Dedupe
    • Labels:
    • Versioning Impact:
      Major (incompatible API change)
    • Documentation Required?:
      User and Admin Doc
    • Funding Source:
      Needs Funding

      Description

      Steps to reproduce this error:

      1. Create a new Deduplication Rule
      2. Select the Email field
      3. Set the Weight to 0 (zero)
      4. Set the Weight Threshold to Consider Contacts 'Matching' to 0 (zero)
      5. Save the Deduplication Rule
      6. Edit an existing Contact
      7. Save changes
      8. You should see a similar error in the CiviCRM error logs as shown below.

      Recommended fix: Prevent the user from saving a Deduplication Rule with weight and weight threshold of 0.
       

      Sep 10 18:22:10 [info] $Fatal Error Details = Array
       (
       [callback] => Array
       (
       [0] => CRM_Core_Error
       [1] => handle
       )
      
      [code] => -2
       [message] => DB Error: syntax error
       [mode] => 16
       [debug_info] => INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [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 'GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)' at line 1]
       [type] => DB_Error
       [user_info] => INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [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 'GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)' at line 1]
       [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [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 'GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)' at line 1]"]
       )
      
      Sep 10 18:22:10 [info] $backTrace = #0 /xxxxx/plugins/civicrm/civicrm/CRM/Core/Error.php(235): CRM_Core_Error::backtrace("backTrace", TRUE)
       #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
       #2 /xxxxx/plugins/civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
       #3 /xxxxx/plugins/civicrm/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: syntax error", -2, 16, (Array:2), "INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
       #4 /xxxxx/plugins/civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-2, 16, (Array:2), "INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
       #5 /xxxxx/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -2, NULL, NULL, "INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...", "DB_Error", TRUE)
       #6 /xxxxx/plugins/civicrm/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-2, NULL, NULL, NULL, "1064 ** You have an error in your SQL syntax; check the manual that correspon...")
       #7 /xxxxx/plugins/civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
       #8 /xxxxx/plugins/civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
       #9 /xxxxx/plugins/civicrm/civicrm/packages/DB/DataObject.php(2442): DB_common->query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
       #10 /xxxxx/plugins/civicrm/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
       #11 /xxxxx/plugins/civicrm/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
       #12 /xxxxx/plugins/civicrm/civicrm/CRM/Dedupe/BAO/RuleGroup.php(261): CRM_Core_DAO->query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
       #13 /xxxxx/plugins/civicrm/civicrm/CRM/Dedupe/Finder.php(62): CRM_Dedupe_BAO_RuleGroup->fillTable()
       #14 /xxxxx/plugins/civicrm/civicrm/CRM/Contact/Page/DedupeFind.php(190): CRM_Dedupe_Finder::dupes("8")
       #15 /xxxxx/plugins/civicrm/civicrm/CRM/Core/Invoke.php(312): CRM_Contact_Page_DedupeFind->run((Array:3), NULL)
       #16 /xxxxx/plugins/civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
       #17 /xxxxx/plugins/civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
       #18 /xxxxx/plugins/civicrm/civicrm.php(1189): CRM_Core_Invoke::invoke((Array:3))
       #19 [internal function](): CiviCRM_For_WordPress->invoke("")
       #20 /xxxxxwp-includes/plugin.php(503): call_user_func_array((Array:2), (Array:1))
       #21 /xxxxxwp-admin/admin.php(236): do_action("toplevel_page_CiviCRM")
       #22
      {main}
      

      Agileware reference SUP-1651

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              yvose Yvo Sedla
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 1 week
                1w
                Remaining:
                Remaining Estimate - 1 week
                1w
                Logged:
                Time Spent - Not Specified
                Not Specified