Recently I had a bad time on upgrading a postgis 1.5 database to postgis 2.0
All my spatial queries begin to fail with:
DatabaseError: Coordinate values are out of range [-180 -90, 180 90] for GEOGRAHY type
This error means there are rows in database with invalid coordinates. I found it weird because it worked well with postgis 1.5, and by ploting the coordinates in google maps, the point was found correctly.
After some time I could find the answer. I was storing coordinates on database as: latitude, longitude. But WGS84 system with postgis, coordinates should be longitude, latitude.
For some reason, postgis 1.5 doesn't come up with this error.
The solution was simple swap coordinates, in django, the point object became something like this:
from django.contrib.gis.geos import Point Point(x=longitude, y=latitude)