How to get the type of geometry column in postgres? I need to determine the type of geometry column and doing it with the following query:

SELECT type 
FROM   geometry_columns 
WHERE  f_table_schema = 'public' 
       AND f_table_name = 'table_name' 
       AND f_geometry_column = 'col_name' 


It works fine for regular geometries, like Point or Polygon. But then there are also some fancy geometries like PointZ. How do I determine if column has it? Above mentioned query returns just POINT for it.
The geometry_columns view takes care to remove any Z/M suffixes.

You can look up the PostGIS type modifier directly in the system tables:

SELECT postgis_typmod_type(atttypmod)
FROM pg_attribute
WHERE attrelid = 'public.table_name'::regclass
  AND attname = 'col_name';


(The same can be done with postgis_typmod_srid().)