#35002: nulls_distinct not honored for ALTER
-------------------------------------+-------------------------------------
Reporter: Peter | Owner: nobody
Thomassen |
Type: Bug | Status: new
Component: Database | Version: 5.0
layer (models, ORM) |
Severity: Release | Keywords:
blocker |
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The SQL template for creating uniqueness constraints
(BaseDatabaseSchemaEditor.sql_create_unique) does not include the
`nulls_distinct` field necessary to support #34701.
As a result, adding a UNIQUE NULLS NOT DISTINCT on migration will end up
with standard UNIQUE constraint.
Replacing
{{{
"UNIQUE (%(columns)s)%(deferrable)s"
}}}
with
{{{
"UNIQUE%(nulls_distinct)s (%(columns)s)%(deferrable)s"
}}}
on line 114 (5.0rc1) worked for me. I'll be happy to create a PR for that.
Also, I noticed that the `include` field does not appear to be rendered in
this template as well, although the UniqueConstraint class does have an
`include` argument. I wonder if it should also be included there, as
follows (inspired by the sql_create_unique_index template, which I think
should only differ w.r.t. to the condition field):
{{{
"UNIQUE%(nulls_distinct)s (%(columns)s)%(include)s%(deferrable)s"
}}}
I picked "release blocker" because it's a new feature that's broken, not a
random bug unrelated to this release. I hope that was right.
--
Ticket URL: <https://code.djangoproject.com/ticket/35002>
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/0107018c1c1fb434-4db8c11e-bfba-423f-990c-4eb6300f716e-000000%40eu-central-1.amazonses.com.