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.
* stage: Unreviewed => Accepted
Comment:
Definitely a release blocker thanks for testing against the release
candidate.
Please submit a PR with the proposed changes and a regression test. I'd
suggest making the `includes` change in a distinct commit as this feature
was added in 3.2 and thus I don't think it will qualify for a backport.
--
Ticket URL: <https://code.djangoproject.com/ticket/35002#comment:1>
* has_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/35002#comment:2>
Comment (by Mariusz Felisiak):
Peter, Do you have time today or tomorrow to work on this? The final 5.0
release is scheduled for Monday, so we're in a hurry. If you don't have
time, I can handle it.
--
Ticket URL: <https://code.djangoproject.com/ticket/35002#comment:3>
Comment (by Peter Thomassen):
I should be able to do it tomorrow.
--
Ticket URL: <https://code.djangoproject.com/ticket/35002#comment:4>
Comment (by Peter Thomassen):
I should be able to do it tomorrow.
--
Ticket URL: <https://code.djangoproject.com/ticket/35002#comment:5>
* owner: nobody => Peter Thomassen
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/35002#comment:6>
Comment (by Peter Thomassen):
FYI, I am on it. -- I found that the `includes` field missing in this
template isn't a bug, because when that modifier is given, another
template is used (`sql_create_unique_index`). The patch will thus contain
only the fix for `sql_create_unique`.
--
Ticket URL: <https://code.djangoproject.com/ticket/35002#comment:7>
* has_patch: 0 => 1
Comment:
Patch is here: https://github.com/django/django/pull/17567
Note the comment there regarding the second test.
--
Ticket URL: <https://code.djangoproject.com/ticket/35002#comment:8>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/35002#comment:9>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"54cb1a7e160089cea438f50fdb70aaaf6823786e" 54cb1a7e]:
{{{
#!CommitTicketReference repository=""
revision="54cb1a7e160089cea438f50fdb70aaaf6823786e"
Fixed #35002 -- Made UniqueConstraints with fields respect nulls_distinct.
Regression in 595a2abb58e04caa4d55fb2589bb80fb2a8fdfa1.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35002#comment:10>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"cb013fc7d9be5faf59f79b6e59ab04e751d05a16" cb013fc]:
{{{
#!CommitTicketReference repository=""
revision="cb013fc7d9be5faf59f79b6e59ab04e751d05a16"
[5.0.x] Fixed #35002 -- Made UniqueConstraints with fields respect
nulls_distinct.
Regression in 595a2abb58e04caa4d55fb2589bb80fb2a8fdfa1.
Backport of 54cb1a7e160089cea438f50fdb70aaaf6823786e from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35002#comment:11>