connection.queries reports different SQL query than MySQL log
|Reported by:||creecode||Owned by:||kmtracey|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I'm using MySQL 5.0.x and Django v1.0.2.
Entry.objects.filter ( content__search = 'heat pipes' )
...is producing this SQL...
SELECT my_app_entry.id, my_app_entry.title, my_app_entry.content, my_app_entry.url, my_app_entry.created, my_app_entry.modified, my_app_entry.website_id FROM my_app_entry WHERE MATCH (my_app_entry.content) AGAINST (heat pipes IN BOOLEAN MODE) LIMIT 21
...as reported from connection.queries. I seem to be getting results back with no reports of errors but if you look closely at the above SQL you'll see there is a syntax error. I verified this by putting the above SQL into a client app that tried to run the above SQL and received an error.
At this point I was a bit confused and took a look at the MySQL log and it reported...
SELECT my_app_entry.id, my_app_entry.title, my_app_entry.content, my_app_entry.url, my_app_entry.created, my_app_entry.modified, my_app_entry.website_id FROM my_app_entry WHERE MATCH (my_app_entry.content) AGAINST ('heat pipes' IN BOOLEAN MODE) LIMIT 21
You'll notice that the query string in the SQL here is properly single quoted.
Change History (3)
comment:1 Changed 6 years ago by kmtracey
- Component changed from Database layer (models, ORM) to Documentation
- Needs documentation unset
- Needs tests unset
- Owner changed from nobody to kmtracey
- Patch needs improvement unset
- Status changed from new to assigned
- Triage Stage changed from Unreviewed to Accepted
comment:2 Changed 6 years ago by kmtracey
- Resolution set to fixed
- Status changed from assigned to closed