Cast timestamp epoch into FLOAT to avoid rounding
On PostgreSQL-12, the epoch FLOAT is now 6 digits but rounded to 5 digits when cast into NUMERIC. issue8779 review264501002
This commit is contained in:
1 parent
d0e95329a3
commit
7729badb30
2 files changed
+2
-1
No files matched your search
@@ -539,7 +539,7 @@ class ModelSQL(ModelStorage):
|
||||
'%s,%s' % (cls.__name__, id_))
|
||||
except KeyError:
|
||||
continue
|
||||
sql_type = fields.Numeric('timestamp').sql_type().base
|
||||
sql_type = fields.Float('timestamp').sql_type().base
|
||||
where.append((table.id == id_)
|
||||
& (Extract('EPOCH',
|
||||
Coalesce(table.write_date, table.create_date)
|
||||
|
||||
@@ -293,6 +293,7 @@ class ModelSQLTestCase(unittest.TestCase):
|
||||
# timestamp precision of sqlite is the second
|
||||
time.sleep(1)
|
||||
|
||||
transaction.timestamp[str(record)] = timestamp
|
||||
ModelsqlTimestamp.write([record], {})
|
||||
transaction.commit()
|
||||
|
||||
|
||||
Reference in new issue
Block a user