I was reading a postgis tutorial and noticed that unlike working with shapefiles, one can actually store different types of geometry in postgres. In a table created with multiple geometry types, the tutorial used:
SELECT ST_X(geom), ST_Y(geom)
FROM geometries
WHERE name = 'Point';
to show X, Y coordinates of a point. I was wondering in general, whether we can use the geometry type in the WHERE
clause to do the same. I tried:
SELECT ST_X(geom), ST_Y(geom), name
FROM geometries
WHERE ST_geometrytype(geom) = ST_Point;
and got:
ERROR: column "st_point" does not exist
LINE 3: WHERE ST_geometrytype(geom) = ST_Point;
^
********** Error **********
ERROR: column "st_point" does not exist
SQL state: 42703
Character: 87
How can I fix this?
text
. You'll need to quote your equivalence valueWHERE ST_geometrytype(geom) = 'ST_Point'