Opened 5 years ago
Closed 5 years ago
#31987 closed Bug (fixed)
Cast() crashes with DurationField on MySQL.
| Reported by: | Petr Čermák | Owned by: | Petr Čermák |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 3.1 |
| Severity: | Normal | Keywords: | mysql |
| Cc: | 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
It is not possible to use:
django.db.models.functions.Cast(x, output_field=DurationField())
because it generated CAST(xxx AS bigint) which is not valid MySQL syntax.
Change History (6)
comment:1 by , 5 years ago
| Needs tests: | set |
|---|---|
| Patch needs improvement: | set |
comment:2 by , 5 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
| Summary: | Cast data type for DurationField is mising for MySQL → Cast() crashes with DurationField on MySQL. |
| Triage Stage: | Unreviewed → Accepted |
comment:3 by , 5 years ago
| Summary: | Cast() crashes with DurationField on MySQL. → Cast() crashes with DurationField on MySQL and Oracle. |
|---|
comment:4 by , 5 years ago
| Needs tests: | unset |
|---|---|
| Patch needs improvement: | unset |
Submitted test looks great, suggested a way to reduce without involving multiple objects and aggregation.
comment:5 by , 5 years ago
| Summary: | Cast() crashes with DurationField on MySQL and Oracle. → Cast() crashes with DurationField on MySQL. |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
Haven't reproduced but you'll need a regression test to demonstrate the issue this addresses.