diff options
| author | Nick Pope <nick@nickpope.me.uk> | 2021-05-29 00:53:18 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-01-02 12:55:12 +0100 |
| commit | 45f778eded9dff59cfdd4dce8720daf87a08cfac (patch) | |
| tree | bfb10dbcf88a4a9ccabcd1b25d61caa20df23f64 /django | |
| parent | f412add786dfc18424eee6281ec8cc97220b04fc (diff) | |
Fixed #35075 -- Added deduplicate_items parameter to BTreeIndex.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/postgres/indexes.py | 9 |
1 files changed, 8 insertions, 1 deletions
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 |
