[gdal-dev] ogr2ogr question

matteo matteo.ghetta at gmail.com
Mon Dec 21 22:55:38 PST 2020


Hi Even,

> If you look at the output of
> ogrinfo PG:..... -sql "select ...."
> you'll see that the resulting layer is called "sql_statement", so your ogr2ogr
> invokation will overwrite/create a sql_statement table in your GPKG. You want
> to add -nln intap to rename this SQL result layer.
> And -overwrite deletes and recreates the table from scratch, so if you've
> customized your template with CHECKs, FOREIGN KEYs etc, they will be lost. If
> the target table in the template is empty, you can just use -append instead of
> -overwrite.

go it, thanks! I was sure that if the table names are the same in both 
input and output, than ogr2ogr was overwriting the output automatically.

Just for information: -overwrite is doing a "truncate table" before 
adding the new features? Is this the reason that FK, CHECKS and other 
customization will be lost?

Cheers and thanks

Matteo


More information about the gdal-dev mailing list