Bug report #19947

ogr "export to postgresql" error when not using the (optional) "primary key (new field)" parameter

Added by Giovanni Manghi about 2 years ago. Updated about 2 years ago.

Status:Closed
Priority:High
Assignee:Nyall Dawson
Category:Processing/OGR
Affected QGIS version:3.3(master) Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27769

Description

The parameter "primary key (new field)" is filled by default with a value "id", but the parameter is not mandatory and a user could not want to use it.
But when clearing this parameter the ogr2ogr call still includes

-lco FID=

that will cause an error. Example:

GDAL command:
ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL PG:" dbname='teste' host=localhost port=5432 user='teste' password='teste' active_schema=public " -lco DIM=2 /home/giovanni/Desktop/teste2.sqlite cac3 -overwrite -lco GEOMETRY_NAME=geom -lco FID= -nln public.teste2 -s_srs EPSG:4326 -a_srs EPSG:4326 -nlt PROMOTE_TO_MULTI
GDAL command output:
ERROR 1: ERROR: zero-length delimited identifier at or near """"

Associated revisions

Revision 6e032531
Added by Nyall Dawson about 2 years ago

[processing][gdal] Fix empty fid is passed if FID option is not set

Also add full range of unit tests for OgrToPostGis algorithm.

Fixes #19947

History

#1 Updated by Nyall Dawson about 2 years ago

  • Assignee set to Nyall Dawson
  • Status changed from Open to In Progress

#2 Updated by Nyall Dawson about 2 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF