Skip to main content
Test if a geometry is well-formed. The function can be invoked with just the geometry or with an additional flag (from v1.5.1). The flag alters the validity checking behavior. The flags parameter is a bitfield with the following options:
  • 0 (default): Use usual OGC SFS (Simple Features Specification) validity semantics.
  • 1: “ESRI flag”, Accepts certain self-touching rings as valid, which are considered invalid under OGC standards.
ST_IsValid

Signatures

ST_IsValid (A: Geometry)
ST_IsValid (A: Geometry, flag: Integer)

Parameters

A
Geometry
required
The input geometry.
flag
Integer
The validation flag.

Return type

Returns true or false.

Example

SELECT ST_IsValid(ST_GeomFromWKT('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0), (15 15, 15 20, 20 20, 20 15, 15 15))'))
false