1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

[4.2.x] Fixed #34459 -- Fixed SearchVector() crash for parameters with % symbol.

Thanks Patryk Zawadzki for the report.

Regression in 09ffc5c121.

Backport of 4bf4222010 from main
This commit is contained in:
Mariusz Felisiak
2023-04-05 19:34:16 +02:00
parent dece89df81
commit db49def5fc
3 changed files with 11 additions and 4 deletions

View File

@@ -160,6 +160,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):