[gdal-dev] How to load a regular table from splite to postgres

Even Rouault even.rouault at mines-paris.org
Wed Dec 21 16:23:38 EST 2011

Le mercredi 21 décembre 2011 22:02:23, aperi2007 a écrit :
> Hi,
> I'm try-ing to load a regular table without geometry from a spatialite
> to a postgres9.1/postgis 2.0 DB.
> I'm using this sintax:
> ogr2ogr.exe -f "PostgreSQL" PG:"dbname='test' active_schema=gb
> schemas=gb,public host='localhost' port='5432' user='postgres'
> password='postgres' " -overwrite -lco SCHEMA=gb -lco GEOMETRY_NAME=geom
> -lco SPATIAL_INDEX=YES db.sqlite table1
> where table1 is the table-name on the spatialite db that I like to write
> on the PG DB.
> When I try this with the ogr2ogr
> I have this error:
> FAILURE: Couldn't fetch request layer 'table'
> I don't understand where is the bug.
> Perhaps ogr2ogr is unable to load regular table without geometry ?

Not exactly. In a Postgis-enabled DB, the PG driver only lists spatial tables 
by default. To access to non spatial tables, you need to define the 
PG_LIST_ALL_TABLES configuration option to YES. See the "Layers" section of 

Ah, and you don't need all those options to specify the schema ! Just 
active_schema=gb should be enough.

> Thx,
> Andrea Peri
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

More information about the gdal-dev mailing list