INT and INTEGER behaves differently (for PRIMARY KEY) !!!
(SQLite 3.3.4)

create table t1 ( id INTEGER PRIMARY KEY );
create table t2 ( id INT PRIMARY KEY );

insert into t1 values(NULL);
insert into t1 values(NULL);
insert into t2 values(NULL);
insert into t2 values(NULL);

/* insert into t1 values('a'); fails */
insert into t2 values('a');

select rowid, id, (id IS NULL) from t1;
select rowid, id, (id IS NULL) from t2;


My observations:

if null is inserted for id column in table t1, it contains 1, 2 
if null is inserted for id column in table t2, it contains null values

if text is inserted for id column in table t1, it fails
if text is inserted for id column in table t2, it allows to insert text


Is it advisable not to use INT but use INTEGER for PRIMARY KEY ??

Rohit
-- 
View this message in context: 
http://www.nabble.com/INT-and-INTEGER-are-not-same%2C-behaves-differently-%28for-PRIMARY-KEY%29---tf1929820.html#a5285466
Sent from the SQLite forum at Nabble.com.

Reply via email to