Skip to content

Commit

Permalink
Merge pull request #376 from tych0/memory-faq
Browse files Browse the repository at this point in the history
add a FAQ entry about :memory: races
  • Loading branch information
mattn authored Jan 27, 2017
2 parents 7ed900a + ded1ba6 commit ce9149a
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 ce9149a

Please sign in to comment.