#250 escape reserved words with backtics

closed-wont-fix
nobody
MySQL (29)
5
2009-02-07
2009-02-07
Anonymous
No

In order to create table and column names using SQL reserved words, as "read", "default", "select", "when" and so on, those names should be enclosed in backticks every time a query is generated:

class Issue(SQLObject):
read = BoolCol()

Issue.CreateTableSQL()
>>>"CREATE TABLE issue (id INT PRIMARY KEY AUTO_INCREMENT, read BOOL)"
Issue.CreateTable()
>>>ProgrammingError: You have an error in your SQL syntax ....

the correct SQL output should be
>>>"CREATE TABLE `issue` (`id` INT PRIMARY KEY AUTO_INCREMENT, `read` BOOL)"

Discussion

  • Oleg Broytman
    Oleg Broytman
    2009-02-07

    • status: open --> closed-wont-fix