Wrong quote character for MySql

Issue #1 resolved
Mauro De Giorgi created an issue

After installing the tool i got this error:

TemplateSyntaxError: Caught DatabaseError while rendering: (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 \'"postman_message" T WHERE T."thread_id" = "postman_message"."thread_id") AS `cou\' at line 1')

I'm using django 1.2.4 and python 2.6

Comments (4)

  1. Mauro De Giorgi reporter

    The error is at line 87 of the models.py:

    .extra(select={'count': 
                'SELECT COUNT(*) FROM "postman_message" T'
                ' WHERE T."thread_id" = "postman_message"."thread_id"'
                }
    

    I don't understand this syntax and why you do that, but this seems to work:

    select={'count': 
                'SELECT COUNT(*) FROM postman_message T'
                ' WHERE T.thread_id = postman_message.thread_id'
                }
    

    Can you tell me something about this?

  2. Patrick Samson repo owner

    Fixed in v1.0.1.

    MySql needs a different quote character in sql commands.

    The app is only tested for : Postgresql, Sqlite, Mysql.

  3. Log in to comment