To recreate:
- Create a test CSV file with a column name that is also an SQL reserved word, eg "Unique"
- Configure a feed to write to a Data table
- Attempt an import
Error messages such as:
user warning: 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 'unique = 1' at line 1 query: SELECT * FROM feeds_data_something WHERE feed_nid = 0 AND unique = 1 in /sites/html/rmtest.sbs-online.net/htdocs/sites/all/modules/data/includes/DataHandler.inc on line 62.
Obviously (for mySQL) the issue is "unique" - my example column name - appearing in a WHERE clause without quotation marks.
Should be quite easy to fix by passing the constructed field names in quotes, but not sure of flow in code so no patch yet. (I don't know if quotes would fix it for other database vendors)
Yes, I know I am stupid for using reserved words for column names, but I was busy thinking about the business aspects of the Feed, not thinking about DB mechanics... :-)
MySQL 5.0 reserved words doco for reference:
http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html
Comments
Comment #1
zevans23 commentedOh - I can't delete that column using the Data screen either, same reason. Anyone know if this is fixed in 7?
Comment #2
kenorb commentedClosed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.