0
0
mirror of https://github.com/django/django.git synced 2024-11-25 07:59:34 +01:00

Fixed CoveringIndexTests.test_covering_partial_index() when DEFAULT_INDEX_TABLESPACE is set.

This commit is contained in:
Mariusz Felisiak 2022-05-03 14:22:34 +02:00 committed by GitHub
parent 3b898ea61e
commit aa8b9279e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
@ -600,11 +601,17 @@ class CoveringIndexTests(TransactionTestCase):
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)),