On 5/17/18, heribert <herib...@scharnagl.com> wrote:
> after updating to release 3.23 the following sql-command do not work any
> 'alter table Inbox add column WasSend boolean default FALSE'
> The command works with 3.20 upto now.
Actually not. What 3.20 was doing was making the default equal to the
string 'FALSE' not to the boolean value of false. (Try it for
yourself and see!) This is not a deadly error since SQLite will
interpret any string that does not begin with a digit as false if it
is used as a boolean, so the string 'FALSE' evaluates to false, by
The bug in 3.20 does cause problem, however, if you use "... default TRUE" :-)
> With 3.23 i got the error: 'Cannot add a column with non-constant default'
I think if you use one of the prerelease snapshots for 3.24 that this
problem will be fixed. By "fixed" I mean that it now works correctly,
and renders and actual boolean result, if the default is either TRUE
> So i looked into the SQLite keyword list... but i didn't find neither
> FALSE nor TRUE. So, why did the FALSE work with 3.20?
For backwards compatibility reasons, TRUE and FALSE are identifiers,
not keywords. They only work like boolean literals if you have no
columns named "true" or "false". In that way, legacy database files
that do have tables with columns named "true" or "false" will continue
to function as they always have.
There are about 1 trillion SQLite database files in circulation. For
that reason, we work very hard to avoid causing problem for those
legacy database files as we enhance SQLite, or as we fix historical
D. Richard Hipp
sqlite-users mailing list