I am trying to put infinity in a FloatField, but that doesn't seem to work. How do I solve this?
f = DjangoModel(float_value=float('inf')) #ok
f.save() #crashes
Results in:
Traceback (most recent call last):
...
ProgrammingError: column "inf" does not exist
LINE 1: ... "float_value") VALUES (inf)
I'm using Django 1.0.2 with PostgreSQL 8.3
It seems like Djangos ORM doesn't have any special handling for this. Pythons representaton of the values are inf and -inf, while PostgrSQL wants 'Infinity' and '-Infinity'. Obviously Djangos ORM doesn't handle that conversion.
So you need to fix the ORM, I guess. And then think about the fact that other SQL databases may very well want other formats, or won't handle infinities at all.