summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorGastón Avila <avila.gas@gmail.com>2024-09-04 17:32:40 -0300
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-09-11 14:40:48 +0200
commit590f5e09f001736aa1fe3f7f086f8a5ab5e4bfdb (patch)
treee05950ceef0e8eb89cc80aec6e9b2aa8b464e8ab /django
parentbf45f0676951243894e3686a80c3ebaa2c1cf107 (diff)
[5.1.x] Fixed #35732 -- Wrapped ConcatPair expression in parentheses to ensure operator precedence.
When ConcatPair was updated to use || this lost the implicit wrapping from CONCAT(...). This broke the WHERE clauses when used in combination with PostgreSQL trigram similarity. Regression in 6364b6ee1071381eb3a23ba6b821fc0d6f0fce75. Backport of c3ca6075cc0ad425bcf905fe14062f38eb9fbcbf from main. Co-authored-by: Emiliano Cuenca <106986074+emicuencac@users.noreply.github.com>
Diffstat (limited to 'django')
-rw-r--r--django/db/models/functions/text.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/functions/text.py b/django/db/models/functions/text.py
index df826ffdb5..9c48659bf9 100644
--- a/django/db/models/functions/text.py
+++ b/django/db/models/functions/text.py
@@ -78,7 +78,7 @@ class ConcatPair(Func):
return super(ConcatPair, coalesced).as_sql(
compiler,
connection,
- template="%(expressions)s",
+ template="(%(expressions)s)",
arg_joiner=" || ",
**extra_context,
)