On 1 Jul 2010, at 2:21pm, Pavel Ivanov wrote:

>>  CREATE TABLE X as SELECT...
>> syntax ought not to produce a table with an INT primary key if the prototype
>> had INTEGER.

The problem is not with primary keys, it's with the types of the columns in the 
table.  The command is not

CREATE TABLE y AS TABLE ...

or

CREATE TABLE y BY COPYING TABLE ...

it's

CREATE TABLE y AS SELECT ...

>From <http://www.sqlite.org/datatype3.html> it can be seen that there is no 
>such datatype as INT.  So no values returned by the SELECT command can be INT. 
> Therefore no columns of the new table should be INT, they should be INTEGER 
>instead.  However ...

> sqlite> create table t (id integer primary key, t text);
> sqlite> create table t_copy as select * from t;
> sqlite> .s
> CREATE TABLE t (id integer primary key, t text);
> CREATE TABLE t_copy(id INT,t TEXT);

This is obviously wrong.  The SELECT command from TABLE t could never have 
returned any INT values (because SQLite has no INT datatype).  So why was TABLE 
t_copy created with an INT column ?

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

Reply via email to