mirror of
https://github.com/django/django.git
synced 2025-11-25 05:04:26 +00:00
Fixed #34701 -- Added support for NULLS [NOT] DISTINCT on PostgreSQL 15+.
This commit is contained in:
parent
98cfb90182
commit
595a2abb58
13 changed files with 295 additions and 9 deletions
|
|
@ -217,3 +217,17 @@ class UniqueConstraintConditionProduct(models.Model):
|
|||
condition=models.Q(color__isnull=True),
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
class UniqueConstraintNullsDistinctProduct(models.Model):
|
||||
name = models.CharField(max_length=255, blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
required_db_features = {"supports_nulls_distinct_unique_constraints"}
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["name"],
|
||||
name="name_nulls_not_distinct_uniq",
|
||||
nulls_distinct=False,
|
||||
),
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue