Re: [sqlite] defalut value of col

2008-10-22 Thread Dan

On Oct 23, 2008, at 4:51 AM, Dennis Cote wrote:

> 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.

I think so too. Fix is here:

   http://www.sqlite.org/cvstrac/chngview?cn=5839


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


Re: [sqlite] defalut value of col

2008-10-22 Thread Dennis Cote
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 nametypenotnull dflt_value  pk
 --  --  --  --  --  --
 0   test_field  INT 99  0
 1   two text0   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


[sqlite] defalut value of col

2008-10-22 Thread Antoine Caron
Hi guys,

 

  Here's a quick one

 

I'm creating a table using the following :

 

#

CREATE TABLE IF NOT EXISTS `test_table` (

  `test_field` INT NOT NULL DEFAULT -1 

);

#

 

Note the default -1

I then do

 

#

PRAGMA table_info (test_table)

#

 

i'm getting the following

 

>>  "0","test_field","INT","99","NULL","0"

 

I was expecting -1 instead of NULL as default value, can anyone explain me
that ?

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