Bug report #12019

"FAILURE: Unable to open datasource" when running "Import Vector into PostGIS database (available connections)" and having spaces in the datasource path

Added by Olivier Dalang about 9 years ago. Updated about 9 years ago.

Status:Closed
Priority:Normal
Assignee:Giovanni Manghi
Category:Processing/GDAL
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:20222

Description

Hi !

When I run "Import Vector into PostGIS database (available connections)", the script doesn't work when I have spaces in the datasource.

Here's the command generated with no spaces (it works well) :

cmd.exe /C ogr2ogr.exe -progress --config PG_USE_COPY YES -f PostgreSQL PG:"host= 127.0.0.1 port= 5432 user= postgres dbname= dtk_attestations password= postgres " -lco DIM=2 "D:/Users/Olivier/importsDXF/Point.shp" -overwrite -nlt POINT -lco SCHEMA=public -lco GEOMETRY_NAME=geom -lco FID=id -nln testestestestsetse324324 -s_srs EPSG:4326 -t_srs EPSG:4326 -spat 1304.93401025 491.40523947 3223.26112517 2256.95570866

And here's the command with spaces (it doesn't work well, I get that "unable to open datasource" error) :

cmd.exe /C ogr2ogr.exe -progress --config PG_USE_COPY YES -f PostgreSQL PG:"host= 127.0.0.1 port= 5432 user= postgres dbname= dtk_attestations password= postgres " -lco DIM=2 "\\"D:/Users/Olivier/imports DXF/Point.shp\\"" -overwrite -nlt POINT -lco SCHEMA=public -lco GEOMETRY_NAME=geom -lco FID=id -nln etetstestset3253252 -s_srs EPSG:4326 -t_srs EPSG:4326 -spat 1304.93401025 491.40523947 3223.26112517 2256.95570866

It seems the error comes from the path being quoted twice... I also get the error with postgres datasource, since they also have spaces.

Bests,

Olivier

History

#1 Updated by Giovanni Manghi about 9 years ago

  • Assignee changed from Victor Olaya to Giovanni Manghi

#2 Updated by Giovanni Manghi about 9 years ago

  • OS version deleted (7)
  • Operating System deleted (windows)

#3 Updated by Giovanni Manghi about 9 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

Also available in: Atom PDF