#33279 closed Bug (fixed)
Time zones with minus in names are incorrectly converted.
Reported by: | yakimka | Owned by: | Can Sarıgöl |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | Can Sarıgöl, Carlton Gibson | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Maybe I do something wrong, but I ran into a problem:
In [1]: import zoneinfo In [2]: import datetime In [3]: with timezone.override(zoneinfo.ZoneInfo('Asia/Ust-Nera')): ...: SomeModel.objects.filter(date__date=datetime.datetime.now().date()).only('id').first() ...: SELECT "some_model"."id" FROM "some_model" WHERE ("some_model"."date" AT TIME ZONE 'Asia/Ust+Nera')::date = '2021-11-10'::date ORDER BY "some_model"."id" ASC LIMIT 1 Execution time: 0.003478s [Database: default] --------------------------------------------------------------------------- InvalidParameterValue Traceback (most recent call last) /usr/local/lib/python3.9/site-packages/django/db/backends/utils.py in _execute(self, sql, params, *ignored_wrapper_args) 83 else: ---> 84 return self.cursor.execute(sql, params) 85 InvalidParameterValue: time zone "Asia/Ust+Nera" not recognized
Timezone "Asia/Ust-Nera" supported by psql:
SELECT name FROM pg_timezone_names where name = 'Asia/Ust-Nera';
Reproduced on Postgresql 11 and 12
Change History (10)
comment:1 by , 3 years ago
Cc: | added |
---|---|
Summary: | time zone with dash in name not recognized → Time zones with minus in names are incorrectly converted. |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 3 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 3 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
comment:5 by , 3 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
comment:6 by , 3 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:10 by , 3 years ago
Replying to yakimka:
This fix was not added to version 3.2.10 by mistake?
It's a regression in Django 3.0, per our backporting policy this means it doesn't qualify for a backport to 3.2.x anymore. See Django’s release process for more details.
Note:
See TracTickets
for help on using tickets.
Thanks for the report. Time zones with the minus in names are incorrectly converted:
-Nera
on MySQL and Oracle,Asia/Ust+Nera
on PostgreSQL,Asia/Ust
and+Nera
offset on SQLite.Regression in fde9b7d35e4e185903cc14aa587ca870037941b1.