[gdal-dev] Problem with GPKG, UPSERT, AND OGR2OGR_USE_ARROW_API

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Mon Mar 24 12:32:59 PDT 2025


Hi,

I was testing the UPSERT feature for combining geopackages. I have same tables in both gpkg databases and tables contain partly same, partly different features. There is a unique contraint in one attribute in addition to FID. FID cannot be used as a key for UPSERT because it is a counting number in both tables. Therefore I use -unsetfid as documented in https://gdal.org/en/stable/programs/ogr2ogr.html#cmdoption-ogr2ogr-upsert.

This request fails

ogr2ogr -upsert -unsetfid upserttest3.gpkg upserttest2.gpkg
ERROR 1: failed to execute insert : UNIQUE constraint failed: states.STATE_FIPS
ERROR 1: WriteArrowBatch() failed
ERROR 1: Terminating translation prematurely after failed
translation of layer states (use -skipfailures to skip errors)

But this one works

ogr2ogr -upsert -unsetfid upserttest3.gpkg upserttest2.gpkg --config OGR2OGR_USE_ARROW_API NO

I am not sure if I just should know to avoid the arrow api, of if this behavior could be a bug.

-Jukka Rahkonen-


More information about the gdal-dev mailing list