PostGISGeometry Input

ST_WKTToSQL

What is ST_WKTToSQL?

ST_WKTToSQL is the SQL/MM 3 spelling of the WKT-to-geometry constructor. It accepts a WKT string and returns the geometry.

SQL
ST_WKTToSQL(text WKT)geometry

Equivalent to ST_GeomFromText(WKT) without an explicit SRID — the returned geometry has SRID 0.

When would you use ST_WKTToSQL?

Use ST_WKTToSQL when writing SQL/MM-portable spatial code that must run on multiple database backends. It is the documented standard name, though most PostgreSQL code prefers the shorter ST_GeomFromText.

For code targeting only PostGIS, ST_GeomFromText is the canonical choice.

FAQs

Is it the same as ST_GeomFromText?

Behaviourally yes, except it does not accept an SRID argument. ST_GeomFromText has an additional two-argument overload.

What SRID does it assign?

Zero. Tag with ST_SetSRID after parsing.

Why does PostGIS include SQL/MM aliases?

To support the ISO SQL/MM standard, so applications using SQL/MM-compliant APIs can target PostGIS without rewriting function names.

Is ST_WKTToSQL slower?

No — it's a thin wrapper that calls the same parser.