[gdal-dev] ogr2ogr postgis to sqlite composite primary key issueissue

Scott public at postholer.com
Tue Aug 15 17:57:05 PDT 2023


You could build your column list without that specific column and pass 
it to ogr2ogr (bash):

ogr2ogr -sql "select $(psql -d mydb --pset='footer=off' -F',' -qAc 
"select * from table where false" |sed 's/columnToOmit,//g') from table" 
target.gpkg PG:dbname=mydb


On 8/15/23 17:12, Brent Wood via gdal-dev wrote:
> Hi,
> 
> I'm looking to use ogr2ogr to replicate a Postgis schema into a 
> Spatialite database. (Make a snapshot copy of institutional tables on a 
> field laptop with possible no internet access)
> 
> I have a script to identify the relevant tables and invoke ogr2ogr to 
> copy each table.
> 
> Some of the source (Postgis) tables have a composite primary key. 
> ogr2ogr flags these and says such keys are unsupported. It fails to copy 
> these tables.
> 
> What I'd like it to do is copy the data in such cases but ignore the 
> primary key.
> 
> Is this possible?
> 
> 
> Thanks,
> 
> Brent Wood
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list