From 596c8fce393e7d0be1dbd154aad2c5cb3f4042b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 11 Mar 2010 12:02:29 +0100 Subject: [PATCH] Use double instead of float to store Float fields in MySQL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The precision of MySQL float is not enough to handle all Python floats. From http://docs.python.org/tutorial/floatingpoint.html: "...almost all platforms map Python floats to IEEE-754 “double precision”" --- trytond/backend/mysql/fields.py | 2 +- trytond/backend/mysql/table.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/backend/mysql/fields.py b/trytond/backend/mysql/fields.py index 3f2840ba9c..f3fbd42c68 100644 --- a/trytond/backend/mysql/fields.py +++ b/trytond/backend/mysql/fields.py @@ -55,7 +55,7 @@ class Float(fields.Float): @staticmethod def sql_type(field): - return ('float', 'float') + return ('double', 'double') class Numeric(fields.Numeric): diff --git a/trytond/backend/mysql/table.py b/trytond/backend/mysql/table.py index e9de67c856..4df897b8ef 100644 --- a/trytond/backend/mysql/table.py +++ b/trytond/backend/mysql/table.py @@ -175,7 +175,7 @@ class TableHandler(TableHandlerInterface): ('varchar', 'text'), ('text', 'varchar'), ('date', 'timestamp'), - ('bigint', 'float'), + ('bigint', 'double'), ('int', 'bigint'), ('tinyint', 'bool'), ('decimal', 'numeric'),