Bug report #8636

spatialite provider error when primary key is made from multiple integer columns

Added by Josef Källgården over 10 years ago. Updated over 10 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Data Provider/SpatiaLite
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:17368

Description

Adding new features to a spatialite layer fails when the layer has a primary key made from more than one column and at least one of them is of integer type. The following commit error is shown:

Provider errors:
SQLite error: t2.col_2 may not be NULL
SQL: INSERT INTO "t2"("col_1","col_2") VALUES (?,?)

The bug seems to be related to use of QVariant::LongLong as int type in the spatialite data provider, revision 2f2e0880.

To reproduce the problem. Download attached sample data and project, start editing session for any of the layers t2, t5 or t6 and notice how adding features will fail.

splite_provider_error.zip (312 KB) Josef Källgården, 2013-09-20 02:56 PM

test_18.zip (274 KB) Josef Källgården, 2013-09-22 02:35 AM

Associated revisions

Revision adc850ee
Added by Matthias Kuhn over 10 years ago

[spatialite] Several fixes for provider (Fix #8636)
And fixes the NoGeometry behavior

Revision 09b68784
Added by Matthias Kuhn over 10 years ago

[spatialite] Support for LongLong (Fix #8636)

History

#1 Updated by Giovanni Manghi over 10 years ago

  • Status changed from Open to Feedback

is this a regression since 1.8? Does this happens on 2.0, master or both?

#2 Updated by Josef Källgården over 10 years ago

Yes it is a regression since 1.8, see attached db which contains one table - features can be added in qgis 1.8 but neither with 2.0 nor master.

It does happen on both 2.0 and master (I only found 'master' in the list for affected version).

#3 Updated by Giovanni Manghi over 10 years ago

  • Category set to Data Provider/SpatiaLite

#4 Updated by Bertrand Roux over 10 years ago

I have the same issue but on all integer fields.

I create a simple table with an integer autoincremented field as primary key ("pkfield"), a value field of type integer ("val") and a geometry field (POINT for example). In QGis, when I had a new feature to this layer, I put a value in the value field "val" (for example 1). When I open the attribute table, this value appears. But when I do the commit on the layer, the value is not send to the spatialite database : the feature is created without value in field "val" (no error is raised in QGis).

The strange point is when I update the value field "val" on an existing feature in QGis, the integer value is transmitted to the database on commit...

#5 Updated by Matthias Kuhn over 10 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF