Opened 9 years ago

Closed 9 years ago

#2595 closed defect (worksforme)

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:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


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[0]
... <Post: #3 (2006-08-23)>
>>> x[0].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.

Change History (1)

comment:1 Changed 9 years ago by matt@…

  • Resolution set to worksforme
  • Status changed from new to closed

Ok, problem seems to have gone away...

Note: See TracTickets for help on using tickets.
Back to Top