sqlite in some cases dumps views in wrong order.

how to reproduce on linux:

1) Make the test database with 2 "view". v1 depends on v2. Recreate v2
cat <<_EOF_ | sqlite3 test.sqlite
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE test ( "id1" integer(8,0), "id2" integer(8,0), "id3"
integer(8,0) );
CREATE VIEW v2 as select id1 from test where id1;
CREATE VIEW v1 as select t1.id2 from test as t1 LEFT JOIN v2 ON
t1.id2=v2.id1;
DROP VIEW v2;
CREATE VIEW v2 as select id1 from test where id1;
COMMIT;
_EOF_

2) Dump the base
sqlite3 test.sqlite .dump > test.sqlite.dump
cat test.sqlite.dump
  =>
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE test ( "id1" integer(8,0), "id2" integer(8,0), "id3"
integer(8,0) );
CREATE VIEW v1 as select t1.id2 from test as t1 LEFT JOIN v2 ON
t1.id2=v2.id1;
CREATE VIEW v2 as select id1 from test where id1;
COMMIT;

Here "CREATE VIEW v1" and "CREATE VIEW v2" placed in wrong order.

3) try to restore
cat test.sqlite.dump | sqlite3 test2.sqlite
 =>
Error: near line 4: no such table: main.v2


Is it the user responsibility to follow all dependencies and recreate
"VIEW" tree ?

Best Regards
 Tyumentsev Alexander
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to