OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.3.5

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & Certification
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.3.5
    iconOceanBase Database
    SQL - V 4.3.5
    SQL
    KV
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Geometry processing functions

    Last Updated:2026-02-03 08:48:37  Updated
    share
    What is on this page
    _ST_MakeValid

    folded

    share

    Geometry processing functions operate or transform geometry objects, such as modifying shapes, calculating geometric relations, performing spatial queries, and conducting other spatial analysis.

    OceanBase Database supports the _ST_MakeValid() function of this type.

    _ST_MakeValid

    In a geographic information system (GIS), spatial data often needs to meet certain validity criteria. For example, a valid polygon must be simple (not self-intersecting) and correctly encircled (with clockwise outer rings and counterclockwise inner rings). A polygon is invalid when it intersects with itself, has overlapping rings, or has an exposed hole.

    The _ST_MakeValid() function fixes invalid geometries, such as polygons. _ST_MakeValid() supports projected coordinate systems (PCSs) only, and does not support geographic coordinate systems (GCSs).

    • _ST_MakeValid() accepts only input geometries that use a PCS. A PCS is a planar coordinate system that represents a location on Earth using two coordinates.

    • A GCS is based on the Earth's latitude and longitude system, which takes into account the curvature of the Earth. _ST_MakeValid() does not support GCSs, so input geometries of the function cannot use coordinates based on latitude and longitude.

    The syntax is as follows:

    _ST_MakeValid(geometry input)
    

    where:

    • geometry input indicates the input parameter of the function, which represents the geometry object to be fixed. It can be a geometry object of any type, such as a Point, LineString, or Polygon object.

    Here is an example:

    obclient> select st_astext(_st_makevalid(st_geomfromtext('POLYGON((0 0,1 1,2 2,0 2,1 1,2 0,0 0))')));
    

    In this example, st_geomfromtext('POLYGON((0 0,1 1,2 2,0 2,1 1,2 0,0 0))') converts a polygon in text format into a geometry object. The text string 'POLYGON((0 0,1 1,2 2,0 2,1 1,2 0,0 0))' represents a sequence of vertex coordinates of a polygon. The polygon is invalid because it has self-intersecting vertices.

    Then, _ST_MakeValid(...) fixes the invalid polygon passed in to make it a valid one.

    Finally, ST_AsText(...) converts the valid polygon back to its WKT representation.

    The return result is as follows:

    +-------------------------------------------------------------------------------------+
    | st_astext(_st_makevalid(st_geomfromtext('POLYGON((0 0,1 1,2 2,0 2,1 1,2 0,0 0))'))) |
    +-------------------------------------------------------------------------------------+
    | MULTIPOLYGON(((1 1,2 2,0 2,1 1)),((1 1,0 0,2 0,1 1)))                               |
    +-------------------------------------------------------------------------------------+
    1 row in set
    

    Previous topic

    Spatial format conversion functions
    Last

    Next topic

    _ST_GeoHash
    Next
    What is on this page
    _ST_MakeValid