#26842 closed Uncategorized (invalid)
SQLite3 backend raises error when reading tz-aware datetime value
| Reported by: | Ryo Chijiiwa | Owned by: | Kenneth |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.9 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
When a DateTimeField in a sqlite3 backend contains a timezone-aware value, an error is raised when reading the object. This seems to happen because convert_datetimefield_value doesn't check to make sure the value is naive before passing to make_aware, which raises an error if it receives a tz-aware value.
Change History (5)
comment:1 by , 9 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 9 years ago
comment:3 by , 9 years ago
| Resolution: | → invalid |
|---|---|
| Status: | assigned → closed |
follow-up: 5 comment:4 by , 9 years ago
comment:5 by , 9 years ago
I think an exception is the desired behavior when trying to read a tz-aware value from a db that doesn't support timezone. Here are more info I found about this change: here and here
Replying to ryochiji:
I have a bit of code (a unit test) that works in Django 1.7 and 1.8, but breaks in 1.9. Both 1.7 and 1.8 check the value to see if it's tz-naive (here and here) but not 1.9. Am I to interpret that this change in behavior is by design?
SQLite doesn't support tz-aware datetimes.