#23987: sqlite backend don't always use effective_default
----------------------------------------------+--------------------
Reporter: coldmind | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
Problem found here:
https://github.com/django/django/pull/3700#issuecomment-66838368
Look at this line:
https://github.com/django/django/blob/df9f2e41fae68e2079db61e07569fdc89d1d6343/django/db/backends/sqlite3/schema.py#L73
{{{
if field.has_default():
mapping[field.column] = self.quote_value(
self.effective_default(field)
)
}}}
Main is that effective default will be used only when field already has
default.
That is not correct, because `effective_default` decides what default
would be used.
The second minor problem is that `field.has_default()` check is already in
`effective_default` method, so we don't need to call it twice.
--
Ticket URL: <https://code.djangoproject.com/ticket/23987>
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/051.5f15373985087d1e624caf5b4af74433%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.