Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#23761 closed Bug (fixed)

Mysql validator crashes with None db_type return. - Backport of master fix to 1.7

Reported by: Adam DePue Owned by: Tim Graham
Component: Core (System checks) Version: 1.7
Severity: Release blocker Keywords: mysql db_type
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adam DePue)

When implementing a custom field type with a db_type() method that returns None, on Django 1.6 and below we would signify not to create a column at all.
With Django 1.7, this causes a crash with the mysql backend.
The issue is already fixed in master and this simply backports the safety check.

A fix was made in August in master:
https://github.com/django/django/commit/e9103402c0fa873aea58a6a11dba510cd308cb84#diff-14

The fix contains a lot more than is needed for this specific issue, however the specific changes to django/db/backends/mysql/validation.py would be great to have in Django 1.7.

This worked fine in < Django 1.7 and works fine in upstream.

Change History (9)

comment:1 Changed 6 years ago by Adam DePue

Last edited 6 years ago by Adam DePue (previous) (diff)

comment:2 Changed 6 years ago by Adam DePue

Component: UncategorizedCore (System checks)
Easy pickings: set

comment:3 Changed 6 years ago by Adam DePue

Description: modified (diff)

comment:4 Changed 6 years ago by Adam DePue

Description: modified (diff)

comment:5 Changed 6 years ago by Tim Graham

Easy pickings: unset
Needs tests: set
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

A regression test and a mention in the 1.7.2 release notes is also required.

comment:6 Changed 6 years ago by Adam DePue

PR is updated to include mention in release notes as well as a regression test.
Updated PR here:
https://github.com/django/django/pull/3472

comment:7 Changed 6 years ago by Tim Graham

Needs tests: unset
Owner: changed from nobody to Tim Graham
Status: newassigned

comment:8 Changed 6 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 2d12a599383efff4ac1914e4cc5cf3b08cb2ff53:

[1.7.x] Fixed #23761 -- Fixed crash with MySQL validator and db_type is None.

The issue was fixed on master in e9103402c0fa873aea58a6a11dba510cd308cb84.

comment:9 Changed 6 years ago by Tim Graham <timograham@…>

In e118e3af371ae58cee7420d2ea2020c8bdeb461e:

Fixed #23761 -- Added test for MySQL validator and db_type is None.

The issue was fixed on master in e9103402c0fa873aea58a6a11dba510cd308cb84
so this just forwardports the test and release notes from stable/1.7.x.

Forwardport of 2d12a59938 from stable/1.7.x

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