Bug report #1244

QGIS should warn/disallow selecting shapefiles that contain spaces

Added by pmcdermott - almost 16 years ago. Updated almost 15 years ago.

Assignee:nobody -
Affected QGIS version: Regression?:No
Operating System:All Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:11304


QGIS should either warn or disallow selecting shapefiles which contain spaces in "Add a Vector Layer", and explain why.

The ESRI Shapefile Technical Description says that shapefiles should follow the 8.3 naming convention, using characters a-Z,0-9,_,-. The practical consequence of shapefile names containing spaces is that SQL queries of the shapefiles data using the GDAL library will fail, with an error message of the form:

ERROR 1: SQL: Failed to parse SELECT statement, extra input at 2 token.

I presume this is due to insufficient quoting in the construction of the SQL query statements.

The cause of this error is difficult to track down, and is ultimately due to user input which could be considered erroneous. But given the ease with which spaces can now be inserted into file names, this sort of user error is easy to make.

An alternative approach would be to allow long filesnames and filenames with spaces and other characters, but this would mean moving away from the ESRI specification. SQL queries would have to be properly quoted, and I presume there would need to be some sort of check for valid Xbase table names. (e.g. is a U with an umlaut a valid Xbase table name?)


#1 Updated by Marco Hugentobler over 15 years ago

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

Smizunos patch from ticket #1295 (applied to 3b6f972c (SVN r9788)) fixes this ticket too.

#2 Updated by Anonymous almost 15 years ago

Milestone Version 1.0.0 deleted

Also available in: Atom PDF