From 45f778eded9dff59cfdd4dce8720daf87a08cfac Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Sat, 29 May 2021 00:53:18 +0100 Subject: Fixed #35075 -- Added deduplicate_items parameter to BTreeIndex. --- django/contrib/postgres/indexes.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'django') diff --git a/django/contrib/postgres/indexes.py b/django/contrib/postgres/indexes.py index 363a9431ae..cc944ed335 100644 --- a/django/contrib/postgres/indexes.py +++ b/django/contrib/postgres/indexes.py @@ -117,20 +117,27 @@ class BrinIndex(PostgresIndex): class BTreeIndex(PostgresIndex): suffix = "btree" - def __init__(self, *expressions, fillfactor=None, **kwargs): + def __init__(self, *expressions, fillfactor=None, deduplicate_items=None, **kwargs): self.fillfactor = fillfactor + self.deduplicate_items = deduplicate_items super().__init__(*expressions, **kwargs) def deconstruct(self): path, args, kwargs = super().deconstruct() if self.fillfactor is not None: kwargs["fillfactor"] = self.fillfactor + if self.deduplicate_items is not None: + kwargs["deduplicate_items"] = self.deduplicate_items return path, args, kwargs def get_with_params(self): with_params = [] if self.fillfactor is not None: with_params.append("fillfactor = %d" % self.fillfactor) + if self.deduplicate_items is not None: + with_params.append( + "deduplicate_items = %s" % ("on" if self.deduplicate_items else "off") + ) return with_params -- cgit v1.3