On Tue, Mar 19, 2013 at 12:51 PM, Philipp Kursawe <[email protected]>wrote:

> I created this table
> CREATE TABLE test (dt BIG INT)
> and inserted a value:
> INSERT INTO test VALUES(CURRENT_TIMESTAMP)
>
> This goes through without an error and the physical db file then really
> contains the current timestamp as a string. How can that be? Is the column
> internally converted on the fly?
>

The types you specify for fields are more or less advisory (but do in fact
have an effect on some operations, e.g. MIN()/MAX() calculations really
want number-typed fields). Example:

sqlite> create table t(a BIG INT);
sqlite> insert into t (a) values(7);
sqlite> insert into t (a) values('hi');
sqlite> insert into t (a) values(9.123);
sqlite> select a, typeof(a) from t;
7|integer
hi|text
9.123|real

There are ways to enforce the data type, but (A) i'm not personally
familiar with them, so won't comment and (B) others are and are certainly
formulating their mails in parallel to me.

See also: http://www.sqlite.org/different.html
and search that page for "manifest typing"

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to