On Tue, 2007-07-10 at 16:02 -0700, Joe Wilson wrote:
> --- [EMAIL PROTECTED] wrote:
> > "Scott Hess" <[EMAIL PROTECTED]> wrote:
> > > If you have an fts1 table f, you could drop f_term and f_content, but
> > > you won't be able to drop f itself.  So you would have to name the
> > > fts2 version of f something else, like f2.
> > > 
> > 
> > I probably shouldn't tell you this, but....
> > 
> > There is a pragma:
> > 
> >    PRAGMA writable_schema=ON;
> > 
> > Which when enabled allows you to UPDATE or DELETE against the
> > sqlite_master table.  So you could turn on writable_schema
> > then do:
> > 
> >    DELETE sqlite_master WHERE type='f';
> 
> Will all the btree pages orphaned at rootpage for these rows 
> not be recyclable until you run a full VACUUM?

Like Scott says, it doesn't matter with a virtual table, as it
has no physical representation in the database file except for
the entry in sqlite_master.

But if you delete the record for a regular table or index from
the sqlite_master table using the "writable_schema" backdoor,
you have just corrupted the database. In some cases a VACUUM
will fix this corruption, in some cases not.

The "writable_schema" pragma has another side effect too. When
it is set, if an error occurs while loading the schema then the
error is returned to the user as normal. But internally, the
subset of the schema that did load stays loaded (normally it
would be discarded and reloaded for the next query). So you
can end up with a database connection that can only "see" a
subset of the tables and indices. If you then update a table
that has an index for which the schema failed to load - database
corruption again.

In short - be really careful with this pragma :)

Dan.

       
> ____________________________________________________________________________________
> Get the free Yahoo! toolbar and rest assured with the added security of 
> spyware protection.
> http://new.toolbar.yahoo.com/toolbar/features/norton/index.php
> 
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
> 


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to