pramsey / pgsql-ogr-fdw

PostgreSQL foreign data wrapper for OGR
MIT License
237 stars 34 forks source link

ogr_fdw_info only returns one layer of mdb #111

Closed mattijn closed 8 years ago

mattijn commented 8 years ago

Hi,

I'm experimenting with this great piece of software, which was installed part of postgresql 9.5.4.1/postgis 2.2 32bit (MS Access 32bit, windows 7 64bit). I've managed to get the northwind.mdb example working as is described on this page: http://www.postgresonline.com/journal/archives/346-Querying-MS-Access-and-other-ODBC-data-sources-with-OGR_FDW.html And can query the file from within postgresql

For my own example mdb file it is not going so great though. The file has multiple tables, but only one table is recognized using ogr_fdw_info.

>ogr_fdw_info -s example.mdb
Layers
    GDB_Items

As can be seen from the screenshot, there are many more tables. capture

What else can I do to make a connection to all tables in the mdb file (probably not related, but also when I try to connect to an accdb file like ogr_fdw_info -s example.accdb it mentions ERROR 1: Could not connect to source)

To add: The GDB_Items is not an ODBC format, but an PGeo format. As can be seen from the following command:

>ogr_fdw_info -s example.mdb -l GDB_Items

CREATE SERVER myserver
  FOREIGN DATA WRAPPER ogr_fdw
  OPTIONS (
    datasource 'C:\fdw_data\example.mdb',
    format 'PGeo' );

CREATE FOREIGN TABLE gdb_items (
  fid integer,
  geom geometry,
  objectid integer,
  uuid varchar,
  type varchar,
  name varchar,
  physicalname varchar,
  path varchar,
  datasetsubtype1 integer,
  datasetsubtype2 integer,
  datasetinfo1 varchar,
  datasetinfo2 varchar,
  url varchar,
  definition varchar,
  documentation varchar,
  iteminfo varchar,
  properties integer,
  defaults bytea )
  SERVER myserver
  OPTIONS ( layer 'GDB_Items' );

Maybe related to this: https://trac.osgeo.org/gdal/ticket/5594#comment:9

mattijn commented 8 years ago

After realizing it was a personal geodatabase I imported the tables to a file geodatabase (.gdb) and now it seems to work:

>ogr_fdw_info -s C:\fdw_data\example.gdb
Layers:
  prosnap
  ..
  locatie_profiel
  profielsegstap05

Where all tables starting with GDB are ignored. Hm, while typing this I feel that this GDB stands for geodatabase.