diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-05-03 14:22:34 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-06-21 11:43:53 +0200 |
commit | 1c28443fc92e57588fb9b37b700f97be9fde5982 (patch) | |
tree | c5f3cbf929fb430e0adf53fef24b2904d4f1b703 | |
parent | 0f3b25044c34fd17b6fcde0cb53db0181f212b20 (diff) | |
download | django-1c28443fc92e57588fb9b37b700f97be9fde5982.tar.gz |
[4.0.x] Fixed CoveringIndexTests.test_covering_partial_index() when DEFAULT_INDEX_TABLESPACE is set.
Backport of aa8b9279e40da343f5b91e5aec07f868184056f4 from main
-rw-r--r-- | tests/indexes/tests.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/indexes/tests.py b/tests/indexes/tests.py index 59cad6cc39..3f63f6b33e 100644 --- a/tests/indexes/tests.py +++ b/tests/indexes/tests.py @@ -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 @@ -599,11 +600,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)), |