#33607: PostgresIndex.create_sql() doesn't respect the using argument.
--------------------------------------+------------------------------------
Reporter: Alexandru Mărășteanu | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: contrib.postgres | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
Thanks for the report. `PostgresIndex` is an internal, undocumented API.
However, I agree that `create_sql()` should respect the `using` argument,
so the following diff should be sufficient:
{{{#!diff
diff --git a/django/contrib/postgres/indexes.py
b/django/contrib/postgres/indexes.py
index a0c03681b2..97377d8cb1 100644
--- a/django/contrib/postgres/indexes.py
+++ b/django/contrib/postgres/indexes.py
@@ -25,7 +25,7 @@ class PostgresIndex(Index):
def create_sql(self, model, schema_editor, using="", **kwargs):
self.check_supported(schema_editor)
statement = super().create_sql(
- model, schema_editor, using=" USING %s" % self.suffix,
**kwargs
+ model, schema_editor, using=" USING %s" % (using or
self.suffix), **kwargs
)
with_params = self.get_with_params()
if with_params:
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33607#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107017fda8203c9-ff7dc988-0a61-4b31-bbc3-c8992eb6d7f9-000000%40eu-central-1.amazonses.com.