From 09291e0df2d84f20f7d16f24f9a0bf30265c2ffb Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 9 Jun 2013 17:00:54 -0500 Subject: [PATCH] CAST in sql only when strincly necessary, still, can be better --- VERSION | 2 +- gluon/dal.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 12a4b69a..43e210ee 100644 --- a/VERSION +++ b/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 diff --git a/gluon/dal.py b/gluon/dal.py index cd417ebf..4f169cf3 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -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)):