fixed issue 1291, casting to string for like operator, thanks Dominic
This commit is contained in:
@@ -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
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user