ST_IsValid
Name
ST_IsValid — Tests if a geometry is well-formed in 2D.
Synopsis
    
     boolean
     
      ST_IsValid
     
     (
    
    geometry
    
     g
    
    
     )
    
    ;
   
    
     boolean
     
      ST_IsValid
     
     (
    
    geometry
    
     g
    
    , integer
    
     flags
    
    
     )
    
    ;
   
Description
Test if an ST_Geometry value is well-formed in 2D according to the OGC rules. For geometries that are invalid, the PostgreSQL NOTICE will provide details of why it is not valid. For geometries with 3 and 4 dimensions, the validity still only tested in 2 dimensions.
   For the version with flags,
supported
   
    flags
   
   are documented in
   
    ST_IsValidDetail
   
   This version does not print a NOTICE explaining invalidity.
  
For more information on the definition of geometry validity, refer to "Ensuring OpenGIS compliancy of geometries"
| ![[Note]](images/note.png)  | |
| SQL-MM defines the result of ST_IsValid(NULL) to be 0, while PostGIS returns NULL. | 
Performed by the GEOS module.
The version accepting flags is available starting with 2.0.0.
   
     This method implements the
   
    OpenGIS Simple Features
 Implementation Specification for SQL 1.1.
   
   This method implements the
   
    OpenGIS Simple Features
 Implementation Specification for SQL 1.1.
   
  
   
     This method implements the SQL/MM specification. SQL-MM 3: 5.1.9
   
   This method implements the SQL/MM specification. SQL-MM 3: 5.1.9
  
| ![[Note]](images/note.png)  | |
| Neither OGC-SFS nor SQL-MM specifications include a flag argument for ST_IsValid. The flag is a PostGIS extension. |