If I use pgAdmin to insert a point with an invalid latitude, say 91°, I receive the following notice before the query completes successfully:
NOTICE: Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY
If I use a PDO statement in PHP there doesn't seem to be a way to get at that notice. Even if there were, I don't want to find out that the coercion happened after the fact—I want to prevent the record from being inserted in the first place.
Is there any way to have the insertion of invalid geography points fail?
My first thought was to use a check constraint, but the coercion of invalid values happens before the constraint conditions are evaluated. This means that
ST_Y always returns the coerced value in the range
[-90, 90], and the constraint is never violated.