google-code-export / sqljet

Automatically exported from code.google.com/p/sqljet
0 stars 1 forks source link

INTEGER PRIMARY KEY must be positive #182

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. CREATE TABLE temp(degrees integer primary key)
2. tempTable.insert(-32);

What is the expected output? 

I expect this to work out just fine, because the SQLite spec says:
"[...] all rows within SQLite tables have a 64-bit signed integer key"
Source: https://sqlite.org/lang_createtable.html#rowid

What is more, Android's SQLite implementation allows negative primary keys.

What do you see instead?

An exception is fired:
org.tmatesoft.sqljet.core.SqlJetException: INTEGER PRIMARY KEY column must be 
more than zero: error code is MISUSE

What version of the product are you using?

sqljet-1.1.10.jar

Please provide any additional information below.

This check was introduced on purpose, see SqlJetBtreeDataTable.java:330:

                    if (rowId > 0) {
                        return rowId;
                    } else {
                        throw new SqlJetException(SqlJetErrorCode.MISUSE,
                                "INTEGER PRIMARY KEY column must be more than zero");
                    } 

Original issue reported on code.google.com by NotDiffi...@googlemail.com on 27 Mar 2014 at 10:33

GoogleCodeExporter commented 9 years ago

Original comment by sergey.s...@gmail.com on 2 Apr 2014 at 10:25

GoogleCodeExporter commented 9 years ago
Any update on this issue? Will it be fixed?

Original comment by notdiffi...@gmx.net on 17 Oct 2014 at 8:00