Bug report #9290

Join problems if filename contains dot

Added by jaanvajakas - over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:High
Assignee:Martin Dobias
Category:-
Affected QGIS version:2.0.1 Regression?:No
Operating System:openSUSE Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:17901

Description

If a shapefile being joined has more then one dot in its name (e. g. oo.pp.shp) and it is joined to another SHP file layer (say, rr.shp) then the names of the joined attributes from oo.pp.shp will contain a dot (e. g. oo.pp_aa) which causes problems.

How to reproduce:
1. Open QGIS.
2. Add the files oo.pp.shp and rr.shp (in attachment) as vector layers to the project.
3. Right-click on rr.shp, choose Properties->Joins, Join with oo.pp.shp on field "id".
4. Right-click on rr.shp, choose Save as..., save as "rr2.shp".
5. Right-click on rr.shp, choose Properties->Style->Categorized, choose column oo.pp_aa, click "Classify", click OK.
Expected result: QGIS displays layer rr.shp with the given style.
Actual result: QGIS crashes.
6. Open QGIS again.
7. Add the file rr2.shp as vector layer to the project.
8. Right-click on rr2.shp, choose Filter..., set filter "id = 3", click OK.
Expected result: the filter selects the (only) point on the layer.
Actual result: an error message box appears: "An error occurred when executing the query. The data provider said: OGR3 error 1: Unrecognised field name oo.pp_aa."

At least the bug at point 8 stems from Bug #3030 which is actually a bug of OGR. Has it been reported to OGR? If it's hard to fix in OGR, QGIS should work around it by replacing dots in joined attributes with something else.

I am using openSUSE 13.1 and qgis-master 140102-1.1-x86_64 from the repository http://download.opensuse.org/repositories/Application:/Geo/openSUSE_13.1/ .

oo.pp_rr.zip - test files oo.pp.shp and rr.shp (2.19 KB) jaanvajakas -, 2014-01-04 05:46 AM

Associated revisions

Revision e6c2ecd9
Added by Martin Dobias over 6 years ago

Fix #9290 (crashes in symbology on fields with special characters)

Fixes several crashes and problems with backwards compatibility.
Before expressions were allowed, field names were loaded and saved
unquoted, e.g. x.y - with introduction of expressions it was
necessary to use properly quoted "x.y" name so that expression
is correctly parsed. With these changes both options are possible
and when possible, the unquoted field name is used for compatibility

History

#1 Updated by Matthias Kuhn over 6 years ago

  • Crashes QGIS or corrupts data changed from No to Yes

Confirmed here.

I have fixed an issue which masked the real issue and led to a memory leak in the categorized renderer. However, it does not solve the real issue.
63ba802e059bad37289d58931a22b82acf0b8a51

#2 Updated by Giovanni Manghi over 6 years ago

  • Priority changed from Normal to High

#3 Updated by Martin Dobias over 6 years ago

  • Assignee set to Martin Dobias

#4 Updated by Martin Dobias over 6 years ago

  • Status changed from Open to Closed

#5 Updated by Martin Dobias over 6 years ago

For the second problem I have raised a ticket in GDAL/OGR: http://trac.osgeo.org/gdal/ticket/5379

Also available in: Atom PDF