#29209 closed Bug (fixed)

Cast with TextField crashes on MySQL

Reported by: Sergey Fedoseev Owned by: Sergey Fedoseev
Component: Database layer (models, ORM) Version: 2.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

City.objects.values_list(Cast('id', models.TextField())).first()
ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'longtext) AS `cast1` FROM `test_app_city` ORDER BY `test_app_city`.`id` ASC  LIM' at line 1"

Change History (6)

comment:1 Changed 15 months ago by Sergey Fedoseev

Owner: changed from nobody to Sergey Fedoseev
Status: newassigned

comment:2 Changed 15 months ago by Sergey Fedoseev

Has patch: set

comment:3 Changed 15 months ago by Claude Paroz

Triage Stage: UnreviewedReady for checkin

comment:4 Changed 15 months ago by Tim Graham

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

The new test fails on Oracle.

comment:5 Changed 15 months ago by Sergey Fedoseev

Patch needs improvement: unset

comment:6 Changed 15 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In d696fcca:

Fixed #29209 -- Fixed Cast() with TextField on MySQL and Oracle.

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