postgresql: Loss of precision on large timestamps
self = <swh.storage.tests.test_postgresql.TestStorage object at 0x7fb3a737d2d0>, swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7fb3a7995010>
def test_release_add_large_timestamp(self, swh_storage):
release= Release(name=b'',
message=None,
target=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
target_type=ReleaseTargetType.CONTENT,
synthetic=False,
author=Person(fullname=b'', name=None, email=None),
date=TimestampWithTimezone(timestamp=Timestamp(seconds=137_438_953_472,
microseconds=999985),
offset_bytes=b'+0000'),
metadata=None,
id=b'\x9d\xc05K>\x11\x95\x1a\xc3f\xd2\x95\x14F\xd4o\x84\x1a\xb2A',
raw_manifest=None)
swh_storage.release_add([release])
(rel,) = swh_storage.release_get([release.id])
> assert rel == release, (rel.date, release.date)
E AssertionError: (TimestampWithTimezone(timestamp=Timestamp(seconds=137438953473, microseconds=999985), offset_bytes=b'+0000'), TimestampWithTimezone(timestamp=Timestamp(seconds=137438953472, microseconds=999985), offset_bytes=b'+0000'))
swh/storage/tests/storage_tests.py:2223: AssertionError
Inserted timestamp is 137438953472, but postgresql increments it to 137438953473