Ticket #29886: django_patch

File django_patch, 709 bytes (added by Tom McClure, 6 years ago)

Fixes issue with unaccent when postgres has non-default standard_conforming_strings

Line 
1diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
2index 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({}) || '%%'",
Back to Top