Working around SQLite limitations