Skip to content

Commit

Permalink
add a FAQ entry about :memory: races
Browse files Browse the repository at this point in the history
Closes mattn#204
Closes mattn#309

Signed-off-by: Tycho Andersen <[email protected]>
  • Loading branch information
tych0 committed Jan 26, 2017
1 parent 7ed900a commit ded1ba6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ FAQ

Yes for readonly. But, No for writable. See #50, #51, #209.

* Why is it racy if I use a `sql.Open("sqlite", ":memory:")` database?

Each connection to :memory: opens a brand new in-memory sql database, so if
the stdlib's sql engine happens to open another connection and you've only
specified ":memory:", that connection will see a brand new database. A
workaround is to use "file::memory:?mode=memory&cache=shared". Every
connection to this string will point to the same in-memory database. See
#204 for more info.

License
-------

Expand Down

0 comments on commit ded1ba6

Please sign in to comment.