﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35002	nulls_distinct not honored for ALTER	Peter Thomassen	Peter Thomassen	"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."	Bug	closed	Database layer (models, ORM)	5.0	Release blocker	fixed			Ready for checkin	1	0	0	0	0	0
