Dustin J. Mitchell <dus...@v.igoro.us> wrote: > def combined(): > conn1 = sqlite3.connect("/tmp/my.db") > curs1 = conn1.cursor() > print "1: pragma" ## B > curs1.execute("PRAGMA table_info('foo')") > > conn2 = sqlite3.connect("/tmp/my.db") > curs2 = conn2.cursor() > print "2: create" > curs2.execute("CREATE TABLE foo ( a integer )") > conn2.commit() > conn2.close() ## C > > print "1: select" > # curs1.execute("SELECT * from sqlite_master") ## A > curs1.execute("SELECT * from foo") > > combined() > > This script fails for sqlite-3.6.12 and earlier, and works for > sqlite-3.6.17 and higher. If I add a query of sqlite_master (A), > things work. Remove the PRAGMA (B) and things work. Adding or > removing the close() (C) makes no difference.
You should close the cursor after executing PRAGMA table_info('foo'). You cannot modify database schema while there are still outstanding statements (on the same or other connections). -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users