Extract lat/long from native PostgeSQL point type column

you need to use:

SELECT ST_X(geom), ST_Y(geom) FROM locations;

I suppose that locations is a table of points with the geometry named as "geom".

Hope this helps,


None of these talk about how to extract lat/long with the native point type. Clearly you can't use ST_X() and ST_Y like you can do with a PostGIS Geometery; so here with the native point simply use array-deference syntax [0] and [1]. For example, if you have a native type and you want to go to PostGIS type you can do it like this (from my answer on dba.se).

SELECT ST_MakePoint(p[0],p[1])
FROM ( VALUES (point(-71.1043443253471,42.3150676015829)) ) AS t(p);

You can treat the point type like an array to access the x and y components like this:

SELECT location[0], location[1] FROM locations;