I use a Python ORM called SQLAlchemy, which maps its generic boolean
type to 'boolean' on SQLite - which I subsequently plucked from the
schema and put into an alter statement. If this is going to cause
problems then I can report it to SQLAlchemy, but as John said, this
seems to be treated like a numeric type.

Oh, and just to clarify - in the second alter table statement, it
should have said: default '' - an error with my copying&pasting.

Cheers,

Damien

On Fri, May 29, 2009 at 8:40 AM, John Machin <sjmac...@lexicon.net> wrote:
> On 29/05/2009 2:53 AM, Simon Slavin wrote:
>> On 28 May 2009, at 9:00am, Damien Elmes wrote:
>>
>>> alter table cardModels add column allowEmptyAnswer boolean not null
>>> default 1
>>
>>> sqlite> update cardModels set allowEmptyAnswer = 0;
>>
>> You're obviously used to other implementations of SQL.  'boolean'
>> isn't a legit type name:
>>
>> http://www.sqlite.org/datatype3.html
>
> AFAICT that page says nothing about what is a "legit type name". This
> one does: http://www.sqlite.org/syntaxdiagrams.html#type-name
>
> Here are some examples of legitimate type-names:
>
> dos-prompt>sqlite3
> SQLite version 3.6.14
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> create table foo (c1 jabberwocky, c2 very big inteher whoops
> typo, c3 "3.14159", c4 very variable character (-123456, +666.987), c5
> boolean);
> sqlite> pragma table_info(foo);
> 0|c1|jabberwocky|0||0
> 1|c2|very big inteher whoops typo|0||0
> 2|c3|3.14159|0||0
> 3|c4|very variable character (-123456, +666.987)|0||0
> 4|c5|boolean|0||0
> sqlite>
>
> "boolean" as a type-name will cause the column to have NUMERIC affinity
> according to the rules on the page you quoted, and the OP seems to be
> being careful to restrain values to 0, 1, and NULL, so this all looks
> rather sensible to me.
>
>>
>> This may or may not be the cause of the problem you report, but fix it
>> first.
>
> How would you propose to fix it?
>
> Cheers,
>
> John
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to