[gdal-dev] ogr2ogr changes field length

Even Rouault even.rouault at spatialys.com
Wed Oct 6 08:49:23 PDT 2021


Matteo,

When overwriting, a fresh new file/table is creating, without keeping 
anything from the existing version.

You could probably just blank your target with

ogrinfo target.shp -sql "DELETE FROM target" -dialect SQLITE

and then ogr2ogr -append target.shp PG:....   -nln target

Even

Le 06/10/2021 à 17:37, matteo a écrit :
> Hi list,
>
> I've a script that uses ogr2ogr to copy, actually overwrite, tables 
> from PG to shapfiles.
>
> The PG fields are all text (without a specified length) and the target 
> shapefile that will be overwritten have all text field length equals 
> to 254.
>
> When overwriting the length is changes to 80. Is there any specific 
> option to keep the original field length?
>
> Cheers and thanks
>
> Matteo
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list