[postgis-devel] Typmod Goodness

Paul Ramsey pramsey at opengeo.org
Fri Aug 7 10:15:43 PDT 2009


Check this out, the final reward for typmod!

-- Availability: 1.5.0
CREATE OR REPLACE VIEW GEOGRAPHY_COLUMNS
AS
SELECT
''::text AS f_table_catalog,
n.nspname AS f_table_schema,
c.relname AS f_table_name,
a.attname AS f_geography_column,
geography_typmod_dims(a.atttypmod) AS coord_dimension,
geography_typmod_srid(a.atttypmod) AS srid,
geography_typmod_type(a.atttypmod) AS type
FROM pg_class c,
      pg_attribute a,
      pg_type t,
      pg_namespace n
WHERE c.relkind IN('r','v')
AND t.typname = 'geography'
AND a.attisdropped = false
AND a.atttypid = t.oid
AND a.attrelid = c.oid
AND c.relnamespace = n.oid
AND n.nspname NOT ILIKE 'pg_temp%';


geography=# select * from geography_columns;
-[ RECORD 1 ]------+---------------
f_table_catalog    |
f_table_schema     | public
f_table_name       | foo
f_geography_column | g
coord_dimension    | 2
srid               | 0
type               | Geometry
-[ RECORD 2 ]------+---------------
f_table_catalog    |
f_table_schema     | public
f_table_name       | foo2
f_geography_column | g
coord_dimension    | 3
srid               | 0
type               | PointZ
-[ RECORD 3 ]------+---------------
f_table_catalog    |
f_table_schema     | public
f_table_name       | foo3
f_geography_column | g
coord_dimension    | 4
srid               | 4326
type               | MultiPolygonZM
-[ RECORD 4 ]------+---------------
f_table_catalog    |
f_table_schema     | public
f_table_name       | voo
f_geography_column | g
coord_dimension    | 4
srid               | 4326
type               | MultiPolygonZM


oh, yeah!!!

P



More information about the postgis-devel mailing list