Opened 11 years ago

Closed 11 years ago

#20926 closed Bug (needsinfo)

postgresql 'infinity' raises 'OverflowError: date value out of range' if TZ is east of UTC

Reported by: tim@… Owned by: mburst
Component: Database layer (models, ORM) Version: 1.5
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

When a datetime field is set to 'infinity' by an external application, django will throw an 'OverflowError: date value out of range' when the corresponding model object is modified within django the next time. This only occurs, however, if the timezone which is set is not UTC (in my Example 'Europe/Berlin').

The problem is, that django translates infinity to the maximum allowed timestamp of 9999-12-31 23:59:59 but timezone unaware. When Django tries to make the timestamp timezone aware, it uses the local timezone as default, which makes the timestamp in UTC larger than the maximum allowed timestamp, throwing the Exception.
I would guess, that this only applies for Timezones east of UTC.

Change History (4)

comment:1 by Florian Apolloner, 11 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Claude Paroz, 11 years ago

Component: UncategorizedDatabase layer (models, ORM)
Type: UncategorizedBug

comment:3 by mburst, 11 years ago

Owner: changed from nobody to mburst
Status: newassigned

comment:4 by Aymeric Augustin, 11 years ago

Resolution: needsinfo
Status: assignedclosed

Please install pytz (as recommended by the docs) and check if the bug still happens.

If it does, please reopen the ticket and provide a complete traceback.

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