CAST in sql only when strincly necessary, still, can be better
This commit is contained in:
2
VERSION
2
VERSION
@@ -1 +1 @@
|
||||
Version 2.5.1-stable+timestamp.2013.06.09.16.56.30
|
||||
Version 2.5.1-stable+timestamp.2013.06.09.17.00.11
|
||||
|
||||
@@ -1357,7 +1357,8 @@ class BaseAdapter(ConnectionPool):
|
||||
def expand(self, expression, field_type=None):
|
||||
if isinstance(expression, Field):
|
||||
out = '%s.%s' % (expression.tablename, expression.name)
|
||||
if field_type == 'string':
|
||||
if field_type == 'string' and not expression.type in (
|
||||
'string','text','json','password'):
|
||||
out = 'CAST(%s AS %s)' % (out, self.types['text'])
|
||||
return out
|
||||
elif isinstance(expression, (Expression, Query)):
|
||||
|
||||
Reference in New Issue
Block a user