fixed issue 1291, casting to string for like operator, thanks Dominic

This commit is contained in:
Massimo
2013-01-18 09:14:19 -06:00
parent e90000545b
commit 7b4a0515be
2 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.4.1-alpha.2+timestamp.2013.01.18.09.08.52
Version 2.4.1-alpha.2+timestamp.2013.01.18.09.13.47
+10 -4
View File
@@ -2570,12 +2570,18 @@ class PostgreSQLAdapter(BaseAdapter):
def LIKE(self,first,second):
return '(%s LIKE %s)' % (self.expand(first),
self.expand(second,'string'))
args = (self.expand(first), self.expand(second,'string'))
if not first.type in ('string', 'text', 'json'):
return '(CAST(%s AS CHAR) LIKE %s)' % args
else:
return '(%s LIKE %s)' % args
def ILIKE(self,first,second):
return '(%s ILIKE %s)' % (self.expand(first),
self.expand(second,'string'))
args = (self.expand(first), self.expand(second,'string'))
if not first.type in ('string', 'text', 'json'):
return '(CAST(%s AS CHAR) ILIKE %s)' % args
else:
return '(%s ILIKE %s)' % args
def REGEXP(self,first,second):
return '(%s ~ %s)' % (self.expand(first),