Skip to content

Not able to run SELECT queries when the file isn't writable #84

@prasanthbj05

Description

@prasanthbj05

Hi, I'm using Perl DBI (1.643) and DBD::SQLite (1.66) modules in an application that needs to interact with SQLite files.
The application would need to run some SELECT queries to fetch information and does this using the prepare() and execute() methods. However, I get this error:
DBD::SQLite::st execute failed: attempt to write a readonly database

The error goes away when I make the file writable, but why is this restriction placed? Until now, the application was using DBD::SQlite version 1.13 and didn't need the file to be writable. I agree that for operations like INSERT etc. which would modify the database, it makes sense to have the file to be writable. However, fetching information using SELECT queries shouldn't ideally require the file to be writable.

I ran some tests and found that this is case starting from version 1.39, until version1.37, the SELECT queries work even when the file isn't writable. Could I please know if the file writability is a bug or a requirement (and if yes, then why)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions