On Fri, 19 May 2017 12:47:32 -0600
"Keith Medcalf" <kmedc...@dessus.com> wrote:

> > Create table test (id integer not null primary key, data text);
> > insert into test values (null, 'row1');
> > select * from test;
> > 1, row1

> Specifying NOT NULL on an INTEGER PRIMARY KEY (which is an alias for
> the RowID) is a redundant redundancy.  The RowID cannot be null and
> must have a value.  

Maybe, but despite saying it twice, the INSERT succeeded, when it
should return an error.  

> but should the not null constraint be obeyed?

> Trying to insert a null value is how you get one generated for you.  

I just want to point out how peculiar that is.  This is the test:

1.  The datatype must be integer
2.  The column must be in the primary key
3.  The DBMS must be SQLite

If the above are all true, then, and only then, the INSERT "succeeds"
in the sense that the data inserted into the database are neither what
the application supplied, nor what is expressed in the DDL.  

It's a documented feature, so it's not a bug.  But it is decidedly
odd.  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to