1 | diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
|
---|
2 | index ad6c504261..9de9b44735 100644
|
---|
3 | --- a/django/db/backends/postgresql/base.py
|
---|
4 | +++ b/django/db/backends/postgresql/base.py
|
---|
5 | @@ -121,7 +121,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
---|
6 | #
|
---|
7 | # Note: we use str.format() here for readability as '%' is used as a wildcard for
|
---|
8 | # the LIKE operator.
|
---|
9 | - pattern_esc = r"REPLACE(REPLACE(REPLACE({}, '\', '\\'), '%%', '\%%'), '_', '\_')"
|
---|
10 | + pattern_esc = r"REPLACE(REPLACE(REPLACE({}, E'\\', E'\\\\'), E'%%', E'\\%%'), E'_', E'\\_')"
|
---|
11 | pattern_ops = {
|
---|
12 | 'contains': "LIKE '%%' || {} || '%%'",
|
---|
13 | 'icontains': "LIKE '%%' || UPPER({}) || '%%'",
|
---|