> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_isvalid.md).

# ST\_IsValid

{% hint style="info" %}
ST\_IsValid is available from [MariaDB 12.0](/docs/release-notes/community-server/old-releases/12.0/what-is-mariadb-120.md).
{% endhint %}

## Syntax

```bnf
ST_IsValid(g)
```

## Description

Given a geometry input, returns 1 if the argument is geometrically valid according to the OGC specifications, 0 if the argument is not geometrically valid.

Unlike [ST\_Validate](/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_validate.md), requires valid GIS data, or `ERROR 3037 (22023): Invalid GIS data provided to function st_isvalid` is returned.

## Examples

```sql
SELECT ST_IsValid(ST_GeomFromText('LINESTRING (0 0, 1 1)'));
+------------------------------------------------------+
| ST_IsValid(ST_GeomFromText('LINESTRING (0 0, 1 1)')) |
+------------------------------------------------------+
|                                                    1 |
+------------------------------------------------------+

SELECT ST_IsValid(ST_GeomFromText('LINESTRING (0 0, 0 0)'));
+------------------------------------------------------+
| ST_IsValid(ST_GeomFromText('LINESTRING (0 0, 0 0)')) |
+------------------------------------------------------+
|                                                    0 |
+------------------------------------------------------+
```

A [POINT](/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/point.md) requires both x and y coordinates:

```sql
SELECT ST_IsValid(ST_GeomFromText('POINT (0)'));  
ERROR 3037 (22023): Invalid GIS data provided to function st_isvalid.
```

## See Also

* [Geometry Constructors](/docs/server/reference/sql-statements/geometry-constructors.md)
* [ST\_AsText](/docs/server/reference/sql-statements/geometry-constructors/wkt/st_astext.md)

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
