From dfcdc8992f8bbbf072cefa4d325fe5cac5316f3d Mon Sep 17 00:00:00 2001 From: Jayantha Gumballi Date: Thu, 1 Nov 2018 20:44:34 +0530 Subject: Fixed #29886 -- Fixed unaccent lookup when PostgreSQL's standard_conforming_strings option is off. Thanks Tom McClure for the patch. --- django/db/backends/postgresql/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/db/backends/postgresql/base.py') diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index ad6c504261..9de9b44735 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -121,7 +121,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): # # Note: we use str.format() here for readability as '%' is used as a wildcard for # the LIKE operator. - pattern_esc = r"REPLACE(REPLACE(REPLACE({}, '\', '\\'), '%%', '\%%'), '_', '\_')" + pattern_esc = r"REPLACE(REPLACE(REPLACE({}, E'\\', E'\\\\'), E'%%', E'\\%%'), E'_', E'\\_')" pattern_ops = { 'contains': "LIKE '%%' || {} || '%%'", 'icontains': "LIKE '%%' || UPPER({}) || '%%'", -- cgit v1.3