DB.delete does not work with the using clause #28

berndtj opened this Issue Nov 17, 2010 · 1 comment

2 participants


When the db module constructs a delete query with the USING keyword, the USING clause is appended after the WHERE clause. Not sure if this valid for other flavors of SQL, but it is against MySQL syntax.

For instance the following code:

        where='feature_mapping.attribute_id=attributes.attribute_id AND '
              'feature_mapping.feature=$feature AND '
              'attributes.attribute_name IN $attributes',
        vars={'feature': feature,
              'attributes': attributes})

Will generate the following query:

DELETE FROM feature_mapping WHERE feature_mapping.attribute_id=attributes.attribute_id AND feature_mapping.feature='fozzie_spam' AND attributes.attribute_name IN ('FB_SUSPECT_1_06') USING feature_mapping,attributes

This results in a syntax error. Simply putting the USING clause before the WHERE clause solves the issue.


Fixed by 761823b.

@aaronsw aaronsw closed this Jun 21, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment