[postgis-devel] Typmod Goodness
Kevin Neufeld
kneufeld at refractions.net
Fri Aug 7 10:40:36 PDT 2009
That is very kewl Paul! I can hardly wait for this to someday make it's way to the geometry data type.
These are probably whole other discussion items, but you could even add
"AND pg_catalog.pg_table_is_visible(c.oid)"
to your view to filter out entries not in the user's current search_path.
And, may I ask why you filtered out pg_temp tables? Why would you not what to list geography columns on any temporary
tables you may have made?
-- Kevin
Paul Ramsey wrote:
> 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
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
More information about the postgis-devel
mailing list