#31689: Docs should warn about ignore_conflicts making MySQL tinker with your
data
-----------------------------------------+------------------------
Reporter: Tobias Krönke | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
We were caught off guard that MySQL e.g. changes a not nullable date field
into `0000-00-00` when trying to bulk insert with `ignore_conflicts=True`
and `None` as the value for the column. You can read about that behavior
here:
- https://www.mysqltutorial.org/mysql-insert-ignore/
- https://dev.mysql.com/doc/refman/8.0/en/insert.html
{{{
With IGNORE, invalid values are adjusted to the closest values and
inserted;
}}}
Of course, you're encouraged to activate strict mode in MySQL (https
://django-mysql.readthedocs.io/en/latest/checks.html), but this will not
help in this specific case:
https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sql-mode-strict
{{{
If strict mode is enabled, dates with zero parts are not permitted and
inserts produce an error, unless IGNORE is given as well. For INSERT
IGNORE and UPDATE IGNORE, dates with zero parts are inserted as
'0000-00-00'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31689>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/047.16eb3cec4abd6bd9a6ce6ec56419a3a4%40djangoproject.com.