Opened 17 years ago
Closed 17 years ago
#6901 closed (invalid)
Test failures with SQLite (?)
Reported by: | Brodie Rao | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | queryset-refactor |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
db.models.base.Model
uses the old the QuerySet.extra().order_by()
, instead of using QuerySet.extra(..., order_by=...)
. This causes a slew of tests to fail with "PRIMARY KEY must be unique
" on sqlite3
, and maybe other backends too. Changing it to use the new API fixes all failing tests with sqlite3
.
Attachments (2)
Change History (7)
by , 17 years ago
Attachment: | extra-orderby.diff added |
---|
comment:1 by , 17 years ago
Actually, the first change leaves out the call to .values()
, but the tests will fail again with .values()
added unless you apply the updated patch from #6899, which fixes boolean evaluation of ValuesQuerySet
s. I'm attaching a patch with .values()
added back in.
by , 17 years ago
Attachment: | extra-orderby-2.diff added |
---|
db.models.base with updated extra/order_by usage (uses .values() as before)
comment:2 by , 17 years ago
Just to follow up: This issue didn't affect the mysql
and postgresql_psycopg2
backends. All tests pass on both backends with or without the patches.
comment:3 by , 17 years ago
Has patch: | unset |
---|
Which tests do you see failing with SQLite? Since I run the SQLite tests for this branch many times each day when I'm working on it and I see nothing failing there's something else going on here.
The patch you've given has no effect on functionality and only slows things down (the original code just makes sure to remove all ordering, your patch adds in some ordering). There is nothing wrong with using order_by()
with extra()
, providing you aren't trying to order by one of the extra bits, so the current use in the branch is correct.
I think there's something else going on here from what you expect. Please provide more details. Removing 'has_patch' flag, since this patch doesn't fix any problem that exists and makes the queries less efficient.
comment:4 by , 17 years ago
Keywords: | qs-rf removed |
---|---|
Summary: | Old QuerySet.extra().order_by() API is used in Model → Test failures with SQLite (?) |
Changing title to reflect the current status of the problem. Can't go any further on this without more information.
comment:5 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Closing, based on lack of additional information (and the fact that the SQLite tests are passing for everybody else I know, including myself).
Please reopen if you have information about your particular setup that may shed light on the failing tests. A list of failing tests is important to have, too.
db.models.base with updated extra/order_by usage