#34459: SearchVector() can return query strings that are unsafe to combine.
----------------------------------+------------------------------------
Reporter: Patryk Zawadzki | Owner: (none)
Type: Bug | Status: new
Component: contrib.postgres | Version: 4.2
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------
Comment (by David Sanders):
I've confirmed Simon's patch works with this test:
{{{#!diff
diff --git a/tests/postgres_tests/test_search.py
b/tests/postgres_tests/test_search.py
index 6ec20c0654..9b5b841539 100644
--- a/tests/postgres_tests/test_search.py
+++ b/tests/postgres_tests/test_search.py
@@ -161,6 +161,12 @@ class SearchVectorFieldTest(GrailTestData,
PostgreSQLTestCase):
)
self.assertNotIn("COALESCE(COALESCE", str(searched.query))
+ def test_values_with_percent(self):
+ searched = Line.objects.annotate(
+ search=SearchVector(Value("This week everything is 10% off"))
+ ).filter(search="10 % off")
+ self.assertEqual(len(searched), 9)
+
class SearchConfigTests(PostgreSQLSimpleTestCase):
def test_from_parameter(self):
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34459#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701875090815e-10eec8c7-273a-4bfd-8823-d7754629c0fc-000000%40eu-central-1.amazonses.com.