You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we store timedelta python type values to database, it's microseconds are stored improperly:
0:00:00.000005 becomes 0:00:00.500000.
Code sample to reproduce this:
#!/usr/bin/env python
from __future__ import print_function
import os
from datetime import timedelta
try:
import psycopg2cffi as psycopg2
except ImportError:
import psycopg2
connection = psycopg2.connect("user=postgres host=shelter password=%s" % os.environ['PGPASSWORD'])
cursor = connection.cursor()
print(cursor.mogrify('select %s;', [timedelta(microseconds=5)]))
With psycopg2 it prints
b"select '0 days 0.000005 seconds'::interval;"
With psycopg2cffi:
b"select '0 days 0.5 seconds'::interval;"
The text was updated successfully, but these errors were encountered:
When we store timedelta python type values to database, it's microseconds are stored improperly:
0:00:00.000005 becomes 0:00:00.500000.
Code sample to reproduce this:
With psycopg2 it prints
With psycopg2cffi:
The text was updated successfully, but these errors were encountered: