On Thu, 20 Mar 2008 10:23:23 +0100, you wrote:

>...oopss.. I supposed it was a fault of mine.
>Thanks for the support and the help.
>
>Just two points:
>
>1. the "PRAGMA writable_schema=ON" is not described in
>the "official" documentation for the PRAGMA syntax

It's not a supported PRAGMA. In fact, it is very
dangerous to use. It's there for debugging,
recovery(?) and testing only, and shouldn't be used as
a replacement for SQL. 

>2. does this mean that if I create an invalid view in the database, the
>entire database file becomes unreadable because of the "schema error"? 

Yes, if you insert invalid SQL (or any other value) in
sqlite_master by means of "writable_schema" you can
easily damage your database beyond repair.

>I know I can't create an invalid view,
>because SQLite refuses to create it,
>but this seems a problem to me... could SQLite just open the database, and
>complain only on the invalid views (i.e. for instance when I open the view
>to query the data in it)?

If you define views the way you are supposed to define
them, with SQL:

CREATE VIEW viewname AS 
  SELECT ...... 
;

they are validated against the schema immediately, and
rejected if they are not valid. Views that refer to
tables or columns that no longer exist won't give a
schema error, but an error about what's missing when
the view is executed, just like an invalid SELECT
statement would do.

So, it is not a problem until you create your own
problem by using undocumented, unsupported backdoors.
Consider it the same as patching table pages by
hex-editing the database file.

Feel free to do it, but don't expect a safety net.

>Thanks again
>Marco
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to