On 17 Apr 2014, at 1:21am, James K. Lowden <jklow...@schemamania.org> wrote:

> Simon Slavin <slav...@bigfraud.org> wrote:
> 
>> If you really want to do it in the TABLE definition, use the SQLite
>> shell tool to '.dump' the table as a set of SQL commands, edit the
>> dump file to add that constraint, then use the SQLite tool to '.read'
>> the SQL command file.
> 
> Why not just create the new table, then
> 
>       insert into S select * from R;
>       drop table R;
>       alter table S rename to R;
> 
> or similar?

You're right.  I can only come up with two reasons:

(A) The one that made me make the mistake: I'm not yet used to the INSERT ... 
SELECT facility SQLite provides.
(B) The other one: FOREIGN KEYS can prevent you from deleting the first TABLE.

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

Reply via email to