changeset cb8c5a6f3a25 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=cb8c5a6f3a25
description:
        Compare timestamps as Char for inequality

        Databases are too random about rounding when casting epoch into 
numerical
        value. So it is better to check against inequality of the string.

        issue8779
        review254571002
diffstat:

 trytond/model/modelsql.py |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (17 lines):

diff -r 3ff62c9640db -r cb8c5a6f3a25 trytond/model/modelsql.py
--- a/trytond/model/modelsql.py Sat Nov 02 18:07:45 2019 +0100
+++ b/trytond/model/modelsql.py Sun Nov 03 17:49:03 2019 +0100
@@ -539,11 +539,11 @@
                         '%s,%s' % (cls.__name__, id_))
                 except KeyError:
                     continue
-                sql_type = fields.Float('timestamp').sql_type().base
+                sql_type = fields.Char('timestamp').sql_type().base
                 where.append((table.id == id_)
                     & (Extract('EPOCH',
                             Coalesce(table.write_date, table.create_date)
-                            ).cast(sql_type) > timestamp))
+                            ).cast(sql_type) != timestamp))
             if where:
                 cursor.execute(*table.select(table.id, where=where, limit=1))
                 if cursor.fetchone():

Reply via email to