Description
If a column is named group and drupal_write_record called, explicitly setting this column, the INSERT-operation will fail, because MySQL interprets the column name as the keyword GROUP (the same could be true for other keywords).
Proposed bugfix
This could be fixed by either disallowing keywords in column names (in the construction of tables) or by escaping column names with `. (I have not tested the latter for systems other then MySQL).
System used
Debian Linux (etch) with Apache 2.2.3-4, PHP 5.2.0-8 and MySQL 5.0.32. The bug occurs on Drupal 6 and 7, untested for other versions.
The attached patch contains a short (but not very nice) bugfix to proof that "`" actually works.
| Comment | File | Size | Author |
|---|---|---|---|
| core.writeRecord.patch | 604 bytes | Anonymous (not verified) |
Comments
Comment #2
mr.baileysMoving to the database queue. I did a quick test and can confirm that this is still an issue.
Comment #3
damien tournoud commentedYou are supposed not to use reserved words.
Comment #4
Anonymous (not verified) commentedTrue. The problem arose in a module I took over - wouldnt have done that myself. But this is in fact a problem with a database-independent CMS. Maybe one word is reserved in one database and not in another?
Why not forbid those words by default?