Name

ST_IsValid — Tests if a Geometry is well formed.

Synopsis

geometry ST_IsValid (varchar WKT, integer SRID);

Alias

IsValid

Description

Tests if a Geometry is well formed. If the Geometry is an empty set, then return null. If the Geometry is well formed, then return True. Otherwise, return False.

Coordinate Dimensions
2D3DM

-

-

Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006))SQL-MM Part 3
---5.1.9

Examples

SELECT ST_IsValid(ST_GeomFromText('LINESTRING (0 0, 10 10, 20 10, 10 10)'));
 st_isvalid
------------
 t

SELECT ST_IsValid(ST_GeomFromText('POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0),(5 0, 0 5, 5 5, 5 0))'));
 st_isvalid
------------
 f

SELECT ST_IsValid(ST_GeomFromText('POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0),(20 20, 20 30, 30 30, 30 20, 20 20))'));
 st_isvalid
------------
 f

Related functions

ST_IsValidReason