> I assume you've read <https://www.sqlite.org/howtocorrupt.html> .
Thanks. Yes, I had read it but it was worth a refresh. The very last item gave pause...race condition on Windows. See below. > It's worth stating that a zero-length database causes no problem for SQLite. > It does not trigger any error message if you open that database again and > start putting legit things in it. It isn't mentioned in the documentation > (as far as I can see) and it's an edge-case for what constitutes a legitimate > SQLite database file, but it does work the way you'd want it to work. Yes, I knew about that. Not the problem here. > > You can intentionally create a zero-length sqlite database by completing no > commands which create schema. For example, using the shell tool to create a > new database file and then ... > > SQLite version 3.8.10.2 2015-05-20 18:17:19 Enter ".help" for usage hints. > sqlite> BEGIN; > sqlite> CREATE TABLE myTable (myCol TEXT PRIMARY KEY); INSERT INTO > sqlite> myTable VALUES ('zxc'); INSERT INTO myTable VALUES ('zxc'); > Error: UNIQUE constraint failed: myTable.myCol > sqlite> ROLLBACK; > sqlite> COMMIT; > Error: cannot commit - no transaction is active > sqlite> .quit > > The above technically fits the description you gave in your original post. In my case there were about 4 tables created and about 50 INSERTs into them, and the final COMMIT did not trigger an error. I don't think this is it. There is an interesting race condition in Windows that is not much talked about: in the shell. This particular program is run as part of a series of test cases, and the setup for the test involves deleting the database file and then running the program in a batch file. Since about Windows 7 the shell does not wait for a file to be deleted before launching the next process, and if that process uses a file that is being deleted there is a race condition to see what happens next. Specifically it seems to be possible to open a "shadow copy" of the file which can persist while the original file is deleted. I don't understand exactly what happens, but I suspect this might be my problem. I've also put some effort into a clean shutdown, but I don't think that was the problem. It's stopped happening for now, but not really because I found and fixed a bug! Regards David M Bennett FACS Andl - A New Database Language - andl.org _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users