[FIX] Character Truncation problem on updation solved

lp bug: https://launchpad.net/bugs/381204 fixed

bzr revid: jvo@tinyerp.com-20090630073344-crmlcg3hbmiqzthk
This commit is contained in:
Joël Grand-Guillaume @ CampToCamp
2009-06-30 13:03:44 +05:30
committed by Jay (Open ERP)
parent c7bb1da092
commit cc4e06238d
+3 -1
View File
@@ -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))