#21163: MySQL backend: when settings.DEBUG is True, and the model instance's
creation leads to a query that triggers a warning, the transaction stays
uncommitted.
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.5
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by iljamaas):
This actually is 'on purpose' or 'by design'. (at least it seams like)
see lines 53-55 of django/db/backends/mysql/base.py
{{{
# Raise exceptions for database warnings if DEBUG is on
if settings.DEBUG:
warnings.filterwarnings("error", category=Database.Warning)
}}}
However I think we could question this. Why should a warning ever be
promoted to an Exception?
changing "error" to "default" stops the warnings from being promoted.
In case of being truncation warnings like this, I even think the
warninglevel should be 'always' and not suppressing any sequential
warning, as each warning is actually truncating another record.
--
Ticket URL: <https://code.djangoproject.com/ticket/21163#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.66f88f97ec7dfada6489fe88e9344695%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.