From 411778633e797a80d84be024f08c7bbafb5c645f Mon Sep 17 00:00:00 2001
From: Olivier Laurent <olt@tinyerp.com>
Date: Thu, 12 Feb 2009 11:04:03 +0100
Subject: [PATCH] escape the field name if the field name is a key word (like
 'binary' for exemple)

bzr revid: olt@tinyerp.com-20090212100403-ukaqh4eflhbs9dg0
---
 bin/osv/orm.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/osv/orm.py b/bin/osv/orm.py
index bd1fc41f2a54..a70a3ee2083b 100644
--- a/bin/osv/orm.py
+++ b/bin/osv/orm.py
@@ -1922,7 +1922,7 @@ class orm(orm_template):
                         return "COALESCE(write_date, create_date, now())::timestamp AS %s" % (f,)
                     return "now()::timestamp AS %s" % (f,)
                 if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False):
-                    return "length(%s) as %s" % (f,f)
+                    return 'length("%s") as "%s"' % (f, f)
                 return '"%s"' % (f,)
             fields_pre2 = map(convert_field, fields_pre)
             for i in range(0, len(ids), cr.IN_MAX):
-- 
GitLab