Skip to content

Commit

Permalink
[3.2.x] Fixed CoveringIndexTests.test_covering_partial_index() when D…
Browse files Browse the repository at this point in the history
…EFAULT_INDEX_TABLESPACE is set.

Backport of aa8b927 from main
  • Loading branch information
felixxm committed Jun 21, 2022
1 parent a23c25d commit 2dc85ec
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/indexes/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
from unittest import skipUnless

from django.conf import settings
from django.db import connection
from django.db.models import CASCADE, ForeignKey, Index, Q
from django.db.models.functions import Lower
Expand Down Expand Up @@ -531,10 +532,16 @@ def test_covering_partial_index(self):
condition=Q(pub_date__isnull=False),
)
with connection.schema_editor() as editor:
extra_sql = ""
if settings.DEFAULT_INDEX_TABLESPACE:
extra_sql = "TABLESPACE %s " % editor.quote_name(
settings.DEFAULT_INDEX_TABLESPACE
)
self.assertIn(
'(%s) INCLUDE (%s) WHERE %s ' % (
'(%s) INCLUDE (%s) %sWHERE %s ' % (
editor.quote_name('headline'),
editor.quote_name('pub_date'),
extra_sql,
editor.quote_name('pub_date'),
),
str(index.create_sql(Article, editor)),
Expand Down

0 comments on commit 2dc85ec

Please sign in to comment.