[Python-ideas] datetime: Support infinity

Thomas Güttler guettliml at thomas-guettler.de
Mon Jan 26 09:24:07 CET 2015


Hi,

postgreSQL supports infinity for datetime:

http://www.postgresql.org/docs/current/static/datatype-datetime.html#AEN6027

{{{
infinity 	date, timestamp 	later than all other time stamps
-infinity 	date, timestamp 	earlier than all other time stamps
}}}


Mapping this to python is not possible at the moment.

See:

http://initd.org/psycopg/docs/usage.html#infinite-dates-handling

{{{
PostgreSQL can store the representation of an “infinite” date, timestamp, or interval. Infinite dates are not available 
to Python, so these objects are mapped to date.max, datetime.max, interval.max. Unfortunately the mapping cannot be 
bidirectional so these dates will be stored back into the database with their values, such as 9999-12-31.
}}}

I don't know the internals of the datetime module. I guess it is not possible to support infinity.

What do you think?

   Thomas Güttler


More information about the Python-ideas mailing list