ST_SRID
What is ST_SRID?
ST_SRID returns the SRID integer associated with a geometry. An SRID of 0 indicates that no spatial reference has been set on the geometry.
1ST_SRID(geometry geom) → integer
2ST_SRID(geography geog) → integerThe SRID is metadata stored in the geometry's header — it does not change coordinate values. To inspect coordinates themselves, use ST_X, ST_Y, or ST_AsText.
When would you use ST_SRID?
Use ST_SRID in validation and audit queries to confirm that all geometries in a table carry the expected SRID before running ST_Transform or spatial joins that require matching CRSs. A mixed-SRID column is a common source of silently wrong results.
It is also useful in diagnostic queries that join spatial_ref_sys to display a geometry's full CRS definition alongside its data.
FAQs
What does an SRID of 0 mean?
Undefined — the geometry has no declared spatial reference. Most spatial operations still work, but cross-CRS comparisons will be incorrect. Tag geometries with ST_SetSRID.
How do I look up what a specific SRID represents?
Query spatial_ref_sys: SELECT auth_name, auth_srid, srtext FROM spatial_ref_sys WHERE srid = 4326.
Can a table contain mixed SRIDs?
Yes, unless the geometry column was declared with a typmod like geometry(Point, 4326). Typmod constraints prevent accidental mixing.
Does ST_SRID work on geography?
Yes — geography is always in a geographic CRS (typically 4326). ST_SRID returns that SRID from the geography header.