On 10 Jul 2014 at 11:20, Dan Kennedy <danielk1...@gmail.com> wrote: > On 07/10/2014 04:45 PM, Tim Streater wrote: >> I have just noticed this syntax which will simplify some table creation for >> me. However in some instances where I want to use it, I have a handy SELECT >> available, but I don't want to actually insert a row at that time. Testing >> with the shell, the following appears to work: >> >> attach database ':memory:' as mem; >> create table mem.messages as select * from main.messages limit 0; >> >> and I get a new, empty, table with the same columns. Is this supposed to work >> in this way? The info at http://www.sqlite.org/lang_createtable.html doesn't >> say one way or the other. I'd like to take advantage of this, but not if it >> is undefined behaviour that just happens to work. > > I don't see why that would be undefined behaviour. Adding "WHERE 0" to > the SELECT would also work.
I don't mean that the LIMIT 0 might be undefined behaviour, but that a SELECT returning no rows used with CREATE TABLE, which then happens to do what I want, might be. -- Cheers -- Tim
_______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users