[gdal-dev] ogr2ogr question

matteo matteo.ghetta at gmail.com
Tue Dec 22 01:34:11 PST 2020


Hi Jukka,

thanks for the clarifications.

On 12/22/20 8:36 AM, jratike80 wrote:

> No, -overwrite does not truncate but it drops the table. However, with the
> PostgreSQL driver it is also possible to truncate the table by using this
> documented method  https://gdal.org/drivers/vector/pg.html#vector-pg. Check
> the configuration options
> 
> "OGR_TRUNCATE: If set to “YES”, the content of the table will be first
> erased with the SQL TRUNCATE command before inserting the first feature.
> This is an alternative to using the -overwrite flag of ogr2ogr, that avoids
> views based on the table to be destroyed. Typical use case: “ogr2ogr -append
> PG:dbname=foo abc.shp –config OGR_TRUNCATE YES”."

from what I read, OGR_TRUNCATE YES is a driver option of PG and not of 
GPKG. Will it eventually work if the export (as it is in my case) is 
made from PG to GPKG? The tables in the GPGK will be truncated?

Cheers and thanks

Matteo


More information about the gdal-dev mailing list