[postgis-users] How to get geometry enabled Tables form Postgresql/postgis

Mike Toews mwtoews at gmail.com
Thu Jul 29 06:34:03 PDT 2010


You can either assume that they are all listed in geometry_columns or
geography_columns. Or you can do a more complicated query to include other
tables than in geometry/geography, (this is from QGIS code[1]):

select f_table_name, f_table_schema, upper(type), pg_class.relkind
from geometry_columns, pg_class, pg_namespace
where relname=f_table_name
    and f_table_schema=nspname
    and pg_namespace.oid=pg_class.relnamespace
    and has_schema_privilege(pg_namespace.nspname,'usage')
    and
has_table_privilege('"'||pg_namespace.nspname||'"."'||pg_class.relname||'"','select')
order by f_table_schema,f_table_name;

To search geography, replace "geometry_columns" with "geography_columns".
Geography column support is new in QGIS, and is only in trunk at the moment.

[1]
https://trac.osgeo.org/qgis/browser/trunk/qgis/src/app/postgres/qgspgsourceselect.cpp?rev=13922#L632

-Mike

On 29 July 2010 05:57, venkat <ven.tammineni at gmail.com> wrote:

> Dear All,
>
>
>    How can i retrieve  only spatial enabled tables form the
> database(Postgresql/PostGIS).Please let me know.
>
> I am waiting for your great response.
>
> Thanks and Regards,
>
> Venkat
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100729/c39bb6e4/attachment.html>


More information about the postgis-users mailing list