Bug report #16943

Create virtual layer from OSM import fails on field names with : in them

Added by Tim Bowden almost 3 years ago. Updated over 2 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:DB Manager
Affected QGIS version:2.18.11 Regression?:No
Operating System:Ubuntu Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:24842

Description

Some OSM layers created in spatialite (using built in Vector/OSM menu) have colons in the field name. When trying to create virtual layers either with or without effected fields, an error is returned as such:

Query execution error on DROP TABLE IF EXISTS "rottnest_workshop_polygons"; CREATE VIRTUAL TABLE "rottnest_workshop_polygons" USING QgsVLayer(rottnest_workshop_polygons20170729144756312);: 1 - near ":disposal": syntax error

In this case, where ":disposal" is the remainder of the column name "toilets:disposal".

It is possible to change the column name as a temporary work around, but I'm trying to create a repeatable process where we can update with a fresh copy of the underlying OSM data and have all existing styling/layers etc "just work".

Has been checked on 2.14, 2.18.10 & 2.18.11.

Attached osm data file has tags that create such fields.

rottnest_workshop.osm (2.26 MB) Tim Bowden, 2017-07-29 09:47 AM

Associated revisions

Revision 6c392124
Added by Nyall Dawson over 2 years ago

Fix virtual layers fail if table field names have special characters

Fixes #16943

Revision d95fc60b
Added by Nyall Dawson over 2 years ago

Fix virtual layers fail if table field names have special characters

Fixes #16943

Cherry-picked from 6c392124

History

#1 Updated by Nyall Dawson over 2 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

#2 Updated by Giovanni Manghi over 2 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF