I've setup a civicrm webform wherein logged in users can create a new organization type contact. After adding using the created civicrm webform this error appear.

Database Error Code: 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, 1064
Additional 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]"]
)

Comments

colemanw’s picture

Can you please try a little harder to find the cause of the error. This obviously has something to do with your site configuration (since creating contacts works fine on a vanilla drupal/webform/civicrm install). Some things you can do:
- Enable logging and backtrace to get a more detailed error message
- Check drupal watchdog logs for pertinent errors
- Disable any modules or extensions which may be incompatible with your version of Civicrm
- Ensure you are using the latest versions of everything (CiviCRM 4.4 or 4.5+, Webform 4.0+, Webform-CiviCRM 4.9+)

davej’s picture

colemanw’s picture

Priority: Critical » Normal
Status: Active » Closed (cannot reproduce)
davej’s picture

In case anyone else runs into this database error and finds this issue, I saw it happening on one Drupal/Civi site when doing a password reset and attempting to use the one-time login link. Tracked it down to a misconfigured unsupervised dedupe rule with threshold = 0.

petednz’s picture

Those zeros can be really nasty, have had several clients bring servers to their knees using them.

Added JIRA - unless there is a valid use case for 0. https://issues.civicrm.org/jira/browse/CRM-20216