
c#でSqlite をつかっていた際、特定の条件で64bit数値が32bit化されることを発見。普通の
select
では発生せず、
create table ... as select ...
で発生。
System.Data.SQLite Net.1.0.108で発生。SQLite version 3.24.0.のコマンドラインツールからの実行では発生なし。python 3.5.1 sqlite3 2.6 で発生なし、なので、.Netライブラリ上でのみ起こるっぽい。
元のテーブル
create table test (id integer not null unique primary key, value integer not null);
に下図のような値が入っていた時、
create table tmp as select id,value,value+0 from test;
を実行したら、

となり、value欄の値が化けているのがわかる。-4394967295=0xffffffff付近で化けていることから、64bitが途中で32bit化しているっぽい。value+0となんらかの演算を行ったvalue+0カラムは正常な値になっている。
ちなみにselectだけの
select id,value,value+0 from test;
の場合、問題は起こらない。