From cc4e06238da72bc0622f39cc958078fd457bb4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Grand-Guillaume=20=40=20CampToCamp?= <> Date: Tue, 30 Jun 2009 13:03:44 +0530 Subject: [PATCH] [FIX] Character Truncation problem on updation solved lp bug: https://launchpad.net/bugs/381204 fixed bzr revid: jvo@tinyerp.com-20090630073344-crmlcg3hbmiqzthk --- bin/osv/orm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 4d91e4a213f..1cd3acc08c9 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1633,7 +1633,9 @@ class orm(orm_template): ('int4', 'float', get_pg_type(f)[1], '::'+get_pg_type(f)[1]), ('date', 'datetime', 'TIMESTAMP', '::TIMESTAMP'), ] - if f_pg_type == 'varchar' and f._type == 'char' and f_pg_size != f.size: + # !!! Avoid reduction of varchar field !!! + if f_pg_type == 'varchar' and f._type == 'char' and f_pg_size < f.size: + # if f_pg_type == 'varchar' and f._type == 'char' and f_pg_size != f.size: logger.notifyChannel('orm', netsvc.LOG_INFO, "column '%s' in table '%s' changed size" % (k, self._table)) cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO temp_change_size' % (self._table, k)) cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" VARCHAR(%d)' % (self._table, k, f.size))