All Products
Search
Document Center

ApsaraDB RDS:ST_IsValidReason

Last Updated:Mar 28, 2026

Returns a text description of why a geometry object is valid or invalid.

Syntax

boolean  ST_IsValidReason(geometry  geomA);
boolean  ST_IsValidReason(geometry  geomA , integer  flags);

Parameters

ParameterDescription
geomAThe geometry object to check.
flagsA bitfield that controls validity rules. Set to 1 to treat self-intersecting rings that form holes as valid. This is the Environmental Systems Research Institute (ESRI) flag.

Description

Use ST_IsValidReason together with ST_IsValid to generate a detailed validity report for geometry objects. ST_IsValid returns whether the geometry is valid; ST_IsValidReason returns the reason when it is not.

Examples

SELECT ST_IsValidReason('POLYGON((0 0,0 1,1 0,1 1,0 0))'::geometry);
      st_isvalidreason
----------------------------
 Self-intersection[0.5 0.5]
(1 row)