[Sorry, I sent an HTML email which doesn't seem do be allowed by the mailing 
list. I'm sending the message again as plain text]

Hi,

we are using SQLite in a C# (.Net 4.6, x86 and x64) Application on Windows 10/7 
using the System.Data.Sqlite wrapper from https://system.data.sqlite.org.
We use these properties on the SQLiteConnectionStringBuilder: 
UseUTF16Encoding=true, ForeignKeys=true, FailIfMissing=true, 
RecursiveTriggers=false.

Previously we were using System.Data.SQLite Version 1.0.99.0, which was using 
SQlite 3.9.2. However, after updating to 1.0.100.0 which uses SQLite 3.12.1, we 
are getting the following error as soon as we try to do e.g. a SELECT statement 
on any table from an existing DB that has been created with the older version:

SQLite error (1): AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY
SQLite error (11): database corruption at line 109680 of [fe7d3b75fe]
... (other similar errors)
SQLite error (1): no such table: main.DeviceEndpoint
SQLite error (11): database corruption at line 109680 of [fe7d3b75fe]
SQLite error (11): malformed database schema 
(IDX_DeviceEndpoint_CustomerIDXName) - no such table: main.DeviceEndpoint


The problem seems to be that the tables have been created using the following 
SQL:
CREATE TABLE DeviceEndpoint (
    ID  INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,
    ...
);

It seems the new version does not like the "NOT NULL" be placed between 
"INTEGER" and "PRIMARY KEY", and instead I would have needed to write "ID  
INTEGER  PRIMARY KEY  AUTOINCREMENT  NOT NULL".

While I can fix this for new DBs, I'm not sure if there's a way to change the 
declaration of the DBs that have been created using 3.9.2 and are now accessed 
using 3.12.1. Is this behavior expected?
Also, when looking at https://www.sqlite.org/lang_createtable.html (column-def 
and column-constraint) , the syntax tree doesn't seem to disallow a "NOT NULL" 
between the type and the primary key constraint.


Any idea how to fix this?
Thanks!

Regards,
Konstantin Prei?er

Reply via email to