mirror of https://github.com/django/django.git
Fixed #33539 -- Fixed spaces in WITH SQL for indexes on PostgreSQL.
This commit is contained in:
parent
981615c6b5
commit
7f4fc5cbd4
|
@ -29,7 +29,7 @@ class PostgresIndex(Index):
|
||||||
)
|
)
|
||||||
with_params = self.get_with_params()
|
with_params = self.get_with_params()
|
||||||
if with_params:
|
if with_params:
|
||||||
statement.parts["extra"] = "WITH (%s) %s" % (
|
statement.parts["extra"] = " WITH (%s)%s" % (
|
||||||
", ".join(with_params),
|
", ".join(with_params),
|
||||||
statement.parts["extra"],
|
statement.parts["extra"],
|
||||||
)
|
)
|
||||||
|
|
|
@ -330,9 +330,14 @@ class SchemaTests(PostgreSQLTestCase):
|
||||||
name=index_name,
|
name=index_name,
|
||||||
fastupdate=True,
|
fastupdate=True,
|
||||||
gin_pending_list_limit=64,
|
gin_pending_list_limit=64,
|
||||||
|
db_tablespace="pg_default",
|
||||||
)
|
)
|
||||||
with connection.schema_editor() as editor:
|
with connection.schema_editor() as editor:
|
||||||
editor.add_index(IntegerArrayModel, index)
|
editor.add_index(IntegerArrayModel, index)
|
||||||
|
self.assertIn(
|
||||||
|
") WITH (gin_pending_list_limit = 64, fastupdate = on) TABLESPACE",
|
||||||
|
str(index.create_sql(IntegerArrayModel, editor)),
|
||||||
|
)
|
||||||
constraints = self.get_constraints(IntegerArrayModel._meta.db_table)
|
constraints = self.get_constraints(IntegerArrayModel._meta.db_table)
|
||||||
self.assertEqual(constraints[index_name]["type"], "gin")
|
self.assertEqual(constraints[index_name]["type"], "gin")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
|
Loading…
Reference in New Issue