Skip to content

Support URIs on ATTACH #373

@davidmartos96

Description

@davidmartos96

Hello!
After changing the stack to the latest versions based on sqlite3 v3 (powersync + sqlite_async), we've noticed that some of our read only ATTACHed databases could cause locking issues to the writer isolate if we don't properly ATTACH them with the read only flag ?mode=ro.
https://sqlite.org/uri.html

We still need to isolate to issue to a reproducible case, so I'll update once I have more info, but what we found is that if we mark the database that we attach to as read only with ?mode=ro, it resolves the locking issues. We are using WAL in the main database and sqlite3mc if that matters.

What I would propose is to change the default compilation flags and set SQLITE_USE_URI=1 so that the URI syntax is supported when ATTACHing.

Another option would be using the runtime configuration with sqlite3_config(SQLITE_CONFIG_URI, 1), which is not currently in the bindings. I've tried to expose it, but I wasn't able to make it work correctly, as it needs to be called before sqlite3_initialize, per the sqlite3_config function docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions