mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
[3.2.x] Fixed CoveringIndexTests.test_covering_partial_index() when DEFAULT_INDEX_TABLESPACE is set.
Backport of aa8b9279e40da343f5b91e5aec07f868184056f4 from main
This commit is contained in:
parent
a23c25d84a
commit
2dc85ecf3e
@ -1,6 +1,7 @@
|
|||||||
import datetime
|
import datetime
|
||||||
from unittest import skipUnless
|
from unittest import skipUnless
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.db.models import CASCADE, ForeignKey, Index, Q
|
from django.db.models import CASCADE, ForeignKey, Index, Q
|
||||||
from django.db.models.functions import Lower
|
from django.db.models.functions import Lower
|
||||||
@ -531,10 +532,16 @@ class CoveringIndexTests(TransactionTestCase):
|
|||||||
condition=Q(pub_date__isnull=False),
|
condition=Q(pub_date__isnull=False),
|
||||||
)
|
)
|
||||||
with connection.schema_editor() as editor:
|
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(
|
self.assertIn(
|
||||||
'(%s) INCLUDE (%s) WHERE %s ' % (
|
'(%s) INCLUDE (%s) %sWHERE %s ' % (
|
||||||
editor.quote_name('headline'),
|
editor.quote_name('headline'),
|
||||||
editor.quote_name('pub_date'),
|
editor.quote_name('pub_date'),
|
||||||
|
extra_sql,
|
||||||
editor.quote_name('pub_date'),
|
editor.quote_name('pub_date'),
|
||||||
),
|
),
|
||||||
str(index.create_sql(Article, editor)),
|
str(index.create_sql(Article, editor)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user