Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#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 Ramiro Morales, 14 years ago

Resolution: invalid
Status: newclosed

.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 for django.deb.connection.queries post-1.3 and will be available in 1.4

See the notes that commit adds. If your DB backend is sqlite3 they might explain error in quoting you are seeing.

comment:2 by German M. Bravo, 13 years ago

Cc: German M. Bravo 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.
Back to Top