|Subject:||misleading error message: DBD::SQLite::st execute failed: unable to open database file|
|Date:||Tue, 6 Jul 2010 10:11:48 -0500|
|To:||bug-DBD-SQLite [...] rt.cpan.org|
|From:||David Nicol <davidnicol [...] gmail.com>|
As blogged at:DBD::SQLite::st execute failed: unable to open database file I was surprised to see this, as the application had been working fine yesterday. It turns out that the problem did not have anything to do with permissions on the database file, but rather that the column that the failing select was supposed to be sorting on had grown. When I commented out the ORDER BY clause, my select functioned again just fine. Changing the ORDER BY clause to sort by ROWID made the select fly again, but would not be a long-term win as the table had not been defined with an AUTOINCREMENT primary key. Adding an index on the column that the ORDER BY clause sorts on has solved the problem, and made the select faster, too. The problem remains, that the apparent problem -- the sorting was taking too long, or using too much memory, or something -- was not accurately reflected in the error message. Perhaps this situation could be specifically identified in future SQLite releases, and given a different error message. I don't know if the "unable to open database file" string originates in SQLite itself or in the DBD::SQLite perl module, however. An improved error message might read, for instance, "DBD::SQLite::st execute failed: resource limit reached in unindexed sort"