Meh. ?Formatting:
sqlite> create table cc (c1 integer not null,c2 integer 
check(typeof(c2)<>'null'));
sqlite> insert into cc values (null,null);
Error: NOT NULL constraint failed: cc.c1
sqlite> insert into cc values (1,null);
Error: CHECK constraint failed: cc
sqlite> insert into cc values (1,1);
sqlite> pragma ignore_check_constraints = yes;
sqlite> insert into cc values (1,null);
sqlite>



     On Thursday, September 10, 2015 6:11 PM, Peter Aronson <pbaronson at 
att.net> wrote:



 That would be my assumption. ?And experimentation seems to back it up (at 
least for NOT NULL):
sqlite> create table cc (c1 integer not null,c2 integer 
check(typeof(c2)<>'null'));sqlite> insert into cc values (null,null);Error: NOT 
NULL constraint failed: cc.c1sqlite> insert into cc values (1,null);Error: 
CHECK constraint failed: ccsqlite> insert into cc values (1,1);
sqlite> pragma ignore_check_constraints = yes;sqlite> insert into cc values 
(1,null);sqlite>
Peter 


? ? On Thursday, September 10, 2015 6:02 PM, Simon Slavin <slavins at 
bigfraud.org> wrote:
? 



On 11 Sep 2015, at 1:17am, Peter Aronson <pbaronson at att.net> wrote:

> I do not believe NOT NULL is a CHECK constraint, though you could use gender 
> TEXT CHECK(typeof(gender) <> 'null') is and would work much the same way, 
> though possibly with less efficiency.

Looking at

<https://www.sqlite.org/syntax/column-constraint.html>

maybe the 'constraints' that the documentation refers to are the ones 
specifically declared using CHECK in the table definition.? Perhaps NOT NULL 
and UNIQUE don't count.

Simon.


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




Reply via email to