#16111 closed Bug (invalid)
Invalid SQL string representation from some queries
Reported by: | German M. Bravo | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | German M. Bravo | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
A query like this:
str(User.objects.filter(username='admin').query)
produces invalid sql like this (note the missing ' around 'admin'):
SELECT ... FROM "auth_user" WHERE "auth_user"."username" = admin
The query does produces correct results nonetheless, the problem is only in the string representation... but it's annoying for debugging queries.
Change History (2)
comment:1 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 13 years ago
Cc: | added |
---|---|
UI/UX: | unset |
Nope, my backend is PostgreSQL, the values are unescaped (by the stringification of the query)
Note:
See TracTickets
for help on using tickets.
.query
is undocumented (and probably on its way to disappear) so I don't think a ticket about it is valid. A similar problem in was fixed in r16081 fordjango.deb.connection.queries
post-1.3 and will be available in 1.4See the notes that commit adds. If your DB backend is sqlite3 they might explain error in quoting you are seeing.