get_next_by_FIELD returns itself if it is the last item, under postgres
|Reported by:||matt@…||Owned by:||adrian|
|Component:||Database layer (models, ORM)||Version:|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Sometime in the last few days get_next_by_FIELD seems to have broken under Postgresql. Calling get_next_by_published, where published is a DateTimeField(auto_now_add=True), on the latest item returns that same item again. e.g.
>>> x = Post.objects.all() >>> x ... [<Post: #3 (2006-08-23)>, <Post: #2 (2006-08-20)>, <Post: #1 (2006-08-18)>] >>> x ... <Post: #3 (2006-08-23)> >>> x.get_next_by_published() ... <Post: #3 (2006-08-23)>
Works fine under MySQL (passes all tests, and I don't see the problem). Unfortunately I don't have enough postgres access to run the tests there.