On 22 Oct 2012, at 8:35pm, Paul van Helden <p...@planetgis.co.za> wrote:

>> It would be possible to implement TRUNCATE TABLE on top of that, but
>> this would be only syntactic sugar.
> 
> ..or better portability. TRUNCATE TABLE works (since only a few years)
> nearly everywhere. So when writing portable applications it seems a bit
> silly to make an exception for SQLite if the solution is that simple and
> won't break anything.

The problem is that TRUNCATE TABLE means different things in different SQL 
implementations.  Yes, they do all delete all the rows of a table, but some 
will do it even in violation of foreign key requirements and some won't; some 
allow it to be an element of a transaction whereas some consider it to be a 
schema-changing operation which can violate transaction structure; some obey 
all TRIGGERs involved in deleting rows, others just execute it ignoring 
TRIGGERs.

On 22 Oct 2012, at 9:44pm, Guillaume Saumure <gsaumur...@videotron.ca> wrote:

> Personally, I have ask the question why TRUNCATE TABLE don't work because 
> this command is not listed on http://www.sqlite.org/omitted.html

Because TRUNCATE isn't in SQL92, the version of SQL that this page starts from, 
as clearly stated on that page.  It was introduced as a standard only in 2008, 
and since, as I wrote above, different engines do different things about it, 
anyone writing for portability across different SQL engines never uses it 
because they can never be sure what it does.

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

Reply via email to