#22626 closed Bug (fixed)
SQLite's DatabaseSchemaEditor.quote_value trips on buffer and memoryview instances
Reported by: | loic84 | Owned by: | Raphaël Barrois |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.7-beta-2 |
Severity: | Release blocker | Keywords: | |
Cc: | Andrew Godwin | 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
Since e9a456d11b5b63389b466ed435ef3915f0e79e4c default values for migrations go through get_db_prep_save()
which in case of BinaryField
results in buffer
(PY2) or memoryview
(PY3) instances. This causes a ValueError
since quote_value()
doesn't specifically support these types: https://github.com/django/django/blob/master/django/db/backends/sqlite3/schema.py#L32.
The test case for #22424 (https://github.com/django/django/pull/2634) demonstrates the issue.
Dunno if it's relevant but the Oracle backend falls back to str
rather than raising an exception: https://github.com/django/django/blob/master/django/db/backends/oracle/schema.py#L28
Change History (7)
comment:1 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Version: | master → 1.7-beta-2 |
comment:2 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 11 years ago
Has patch: | set |
---|
comment:4 by , 11 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
I've updated the patch, which has been reviewed by shai.
Marking "Ready for Checkin" with his benediction.
comment:5 by , 11 years ago
I've added this commit to the PR for #22424: https://github.com/django/django/pull/2634.
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
A full patch including test has been added at https://github.com/django/django/pull/2670 (pull request against stable/1.7.x).
This patch also fixes a slight issue in the SQLite backend when re-making a table: default values for new fields where incorrectly quoted with "column name" quoting rules.