#13414 closed (fixed)
QuerySet API ref wrong sql equivalent in __year lookup example
Description ¶
In http://docs.djangoproject.com/en/dev/ref/models/querysets/#year it is said that sql equivalent for
Entry.objects.filter(pub_date__year=2005)
is
SELECT ... WHERE EXTRACT('year' FROM pub_date) = '2005';
but according to current code it should rather be
SELECT ... WHERE pub_date BETWEEN '2005-01-01' AND '2005-12-31 23:59:59.999999';
Change History (7)
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 15 years ago
Attachment: | patch.diff added |
---|
comment:2 by , 15 years ago
Has patch: | set |
---|
follow-up: 4 comment:3 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|---|
Version: | 1.2-beta → SVN |
When I tried this out (on postgres), the query was actually:
SELECT ... WHERE pub_date BETWEEN '2005-01-01 00:00:00' AND '2005-12-31 23:59:59.999999';
(00:00:00 doesn't appear in the patch), but otherwise this looks good to go.
comment:4 by , 14 years ago
Replying to timo:
When I tried this out (on postgres), the query was actually:
SQL in the patch was from MySQL. The reason is a backend, I want to believe :)
comment:5 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:6 by , 14 years ago
Note:
See TracTickets
for help on using tickets.
document patch (Git-format)