[Gdal-dev] PG-Driver supporting no views?
Carl Anderson
carl.anderson at co.fulton.ga.us
Fri Apr 23 10:58:48 EDT 2004
Frank Warmerdam wrote:
> Tyler Mitchell wrote:
>
>> Is this just because there isn't an entry in geometry_columns?
>>
>> Tyler
>
>
> Tyler,
>
> The OGR PG driver isn't restricted to stuff that appears in
> GEOMETRY_COLUMNS.
> I use the following magical query to get a list of tables that can be
> treated
> as layers:
>
> "DECLARE mycursor CURSOR for "
> "SELECT relname FROM pg_class "
> "WHERE relkind = 'r' AND relname !~ '^pg'" );
>
"DECLARE mycursor CURSOR for "
"SELECT relname FROM pg_class "
"WHERE (relkind in ('r','v') AND relname !~ '^pg'" );
> I think I copied that from somewhere else originally. The GEOMETRY_COLUMNS
> is currently only used to lookup SRID values.
>
> So I think the problem is that my query only idenfies proper tables, not
> views.
> If anyone can suggest an appropriate change to pick up queries too, I
> can update
> it more easily.
>
> Best regards,
Frank,
The current method scans and describes every table in the database.
This can take a very long time to do. I have 2000+ tables and the
initialization of the OGR Pg driver takes almost a minute. From a
practical standing that precludes my using in user interfaces.
IMHO for large installations a "dictionary" of geometry tables will be
necessary. To see what is approved for use. GEOMETRY_COLUMNS seems to
have been designed with that in mind.
the OGR_PG driver also supports tables that lack geometry columns and
using GEOMETRY_COLUMNS for that may be a stretch but leaving the
f_geometry_column field as an empty string could be (mis)used to provide
that support.
C.
--
Carl Anderson
GIS Manager, Fulton County E&CD
404.730.8026
carl.anderson at co.fulton.ga.us
More information about the Gdal-dev
mailing list