On Jun 16, 2009, at 8:47 AM, A Drent wrote:
>
> From the docs I read that for the new version:
>
> a.. When new tables are created using CREATE TABLE ... AS SELECT ...
> the
> datatype of the columns is the simplified SQLite datatype (TEXT,
> INT, REAL,
> NUMERIC, or BLOB) instead of a copy of the original datatype from
> the source
> table.
>
> I don't know why this has been done,


It was done to fix a bug.

SQLite allows arbitrary text as the "datatype" of a column.  So you
could say (for example):

    CREATE TABLE t1(a "duh! ++ x hi, yall!(+123)" unique);

And the datatype for t1.a would be "duh! ++ x hi, yall!(+123)".  It
used to be that this datatype would be copied into the synthesized
CREATE TABLE statements for tables generated using CREATE TABLE AS.
But that required that the datatype name be properly quoted so that it
could be parsed again.  The logic that did this quoting was complex
and contained bugs.  It was much easier to strip out the whole thing
and replace it with primitive datatype generator (that inserts "NUM"
in place of the complex string show above) than to try to fix the
quoting for every possible case.


D. Richard Hipp
d...@hwaci.com

Ok, I can see this. But I cannot forsee the real implications though. If I 
have a statement like

create table mytable(pnumber integer, name varchar(20), primary 
key(pnumber))

what are the reported datatypes? still integer and varchar(20)?

regards,
albert

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

Reply via email to