On 9 Oct 2012, at 6:54pm, Adam DeVita <adev...@verifeye.com> wrote:

> The why seems to be something about the necessity of rewriting the
> table, which is 'slow'.  I expect that users accept that Alter table
> can be expensive.    Is there more to it? Some sort of ACID breakdown?

There are problems with ALTER TABLE, but most of them involve very thorough 
checks that the column you're dropping isn't mentioned anywhere: indices, 
foreign keys, constraints, and probably a bunch of things I've forgotten.  The 
way SQLite works means that trying to spot all the places that a column is 
mentioned is very difficult and involves a lot of parsing.  I'm betting that 
it's that which makes it so difficult.  Once you're sure the column isn't 
mentioned, actually dropping it is probably fairly simple: marking pages in the 
data file as unused, rewriting the CREATE TABLE command, and updating the 
schema version number.

It would be nice to be able to drop columns in SQLite4.  Don't bet on it 
appearing before then, or even then.

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

Reply via email to