Opened 11 years ago
Last modified 10 years ago
#22683 closed Cleanup/optimization
Schema tests and .extra queryset method — at Version 1
Reported by: | Maximiliano Robaina | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.7-beta-2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Running schema tests I caught an issue, more precisely, in test_add_field_default_transform
.
At the end, this test method is doing:
self.assertEqual(Author.objects.extra(where=["thing = 1"]).count(), 2)
The problem here is what in this where clause, the "thing" field must be quoted.
In firebird :
SELECT * FROM AUTHOR WHERE thing = 1 -- Here thing (in lowercase) and THING (in uppercase) are equivalent, are the same object
is different of:
SELECT * FROM AUTHOR WHERE "thing" = 1 -- field is quoted
For a more generic test I think we need to avoid use .extra method or another raw sql statement.
For a more complete discussion about it, see at
https://groups.google.com/forum/?hl=es#!topic/django-developers/KRHD77KlZ28
Change History (1)
comment:1 by , 11 years ago
Description: | modified (diff) |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
Version: | 1.6 → 1.7-beta-2 |
Note:
See TracTickets
for help on using tickets.
Added some formatting to description.
We should be able to get rid of the raw sql there, since the model has the added column.