Bug report #11037

DbManager allows users to input missing column names for row id and geometry

Added by Loïc BARTOLETTI about 10 years ago. Updated almost 9 years ago.

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

Description

Atlas crash when using a spatialite VIEW in coverage layer (tested on Window 64 and FreeBSD).
Works fine with PostGis View.

QGis_test_atlas.zip (194 KB) Loïc BARTOLETTI, 2014-08-12 12:05 AM

test_atlas_add_view.png (18 KB) Loïc BARTOLETTI, 2014-08-12 12:05 AM

QGis_test_atlas.zip - New version (312 KB) Loïc BARTOLETTI, 2014-08-12 07:50 AM

Associated revisions

Revision 1a5db863
Added by Nyall Dawson about 10 years ago

[composer] Prevent atlas crash when layer has bad features (refs #11037)

Revision 2a57b170
Added by Giuseppe Sucameli almost 9 years ago

DBManager: avoid loading a query as layer with missing fields (fix #11037),
restore combo style and label when multiple unique fields for view are not supported (follow 8e45da9d7e)

History

#1 Updated by Nyall Dawson about 10 years ago

  • Status changed from Open to Feedback

Do you have a spatialite data file which demonstrates this that I can test with?

#2 Updated by Loïc BARTOLETTI about 10 years ago

Here a project with spatialite data.

test_atlas is a layer
atlas is a view created like this:

CREATE VIEW "atlas" AS 
SELECT "ROWID", "info", ST_Union("geom") as "geom" 
FROM "test_atlas" 
GROUP BY "info" 

and added with DB Manager (see PNG image)

#3 Updated by Nyall Dawson about 10 years ago

I get an error trying to open that zip. Can you please re-upload?

#4 Updated by Loïc BARTOLETTI about 10 years ago

I forget to say that works when I create a table like this:

CREATE TABLE "union_atlas" AS
SELECT "ROWID" as "ROWID" , "info"  as "info", ST_Union("geom") AS "geom" 
FROM "test_atlas" 
GROUP BY "info";

#5 Updated by Nyall Dawson about 10 years ago

  • Subject changed from Composer/Atlas crash when using spatialite VIEW in coverage layer to DbManager allows users to input missing column names for row id and geometry
  • Category changed from Map Composer/Printing to DB Manager
  • Status changed from Feedback to In Progress

Ok - I've fixed the crash (because crashing is bad!), but the real problem is in your query/db manager. In your screenshot you have entered "ROWID" as the unique values column, but this column does not exist in your query. This causes the layer to load in a broken state -- some things work, but the behaviour is undefined (for instance, try opening the attribute table on this layer).

I'm reassigning this bug to db manager plugin as you should not be allowed to input an invalid column name as the unique column or geometry column.

#6 Updated by Sandro Santilli over 9 years ago

  • Crashes QGIS or corrupts data changed from Yes to No

does not cause crash or corruption anymore... is it really in progress ?

#7 Updated by Giuseppe Sucameli almost 9 years ago

  • Status changed from In Progress to Closed

Also available in: Atom PDF