Antoine Caron wrote:
> 
> I was expecting -1 instead of NULL as default value, can anyone explain me
> that ?
> 

That looks like a bug in the table_info pragma. You should probably 
report it.

The following test script shows that the correct default value is used 
even though the an incorrect null value is displayed by the pragma.

     sqlite> CREATE TABLE IF NOT EXISTS test_table
        ...>   (test_field INT NOT NULL DEFAULT -1, two text);
     sqlite> .mode column
     sqlite> .header on
     sqlite> PRAGMA table_info (test_table);
     cid         name        type        notnull     dflt_value  pk
     ----------  ----------  ----------  ----------  ----------  ----------
     0           test_field  INT         99                      0
     1           two         text        0                       0
     sqlite> insert into test_table(two) values('one');
     sqlite> select * from test_table;
     test_field  two
     ----------  ----------
     -1          one


You can report the bug at 
http://www.sqlite.org/cvstrac/captcha?nxp=/cvstrac/tktnew

HTH
Dennis Cote

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

Reply via email to