Hi List,
    I just caught myself in a little circle and accidentally created a semi-invalid database. I was wondering if it's something SQLite's query parser could self-resolve / alert about.

Attach a database as "my_attachment" schema name, and then run:

CREATE VIEW my_attachment.a_view AS
    SELECT * FROM my_attachment.a_table;

If you now disconnect from the database and then re-attach it, this time attaching it as "hello_world" schema name, SQLite will fail to attach it and give this error:     malformed database schema (a_view) - view a_view cannot reference objects in database my_attachment

I understand that I've been "over-specific" in my SQL, but could not the query-parser strip off the schema name from the select statement in the view given it's clearly meant to be self-referential. Or alternatively give a warning/error at creation time if specifying schema names inside of Views that are not TEMP given they're unnecessary for such views. The former would self-solve the problem, the later would provide transparency and stop you accidentally creating invalid schemas that seem valid at the time.

Cheers,
Jonathan



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

Reply via email to