Skip to content

ST_ISVALIDREASON

Returns a text description indicating whether a GEOGRAPHY object is valid. If the object is invalid, the function provides a reason for the invalidity.

This function is useful in combination with ST_ISVALID to generate detailed reports on invalid GEOGRAPHY objects.

See also:

Syntax

sql
ST_ISVALIDREASON(<input>)

Arguments

  • <input>: The GEOGRAPHY object to be tested

Returns

Returns a TEXT value that either states "Valid Geometry" or provides a reason why the input is invalid.

Example

sql
SELECT ST_ISVALIDREASON('POLYGON((0 0, 2 2, 2 0, 0 2, 0 0))'::GEOGRAPHY);
-- 'Self-intersection[1 1]'

SELECT ST_ISVALIDREASON('POINT(1 1)'::GEOGRAPHY);
-- 'Valid Geometry'