Skip to content

Commit ce9149a

Browse files
authored
Merge pull request #376 from tych0/memory-faq
add a FAQ entry about :memory: races
2 parents 7ed900a + ded1ba6 commit ce9149a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ FAQ
6868

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

71+
* Why is it racy if I use a `sql.Open("sqlite", ":memory:")` database?
72+
73+
Each connection to :memory: opens a brand new in-memory sql database, so if
74+
the stdlib's sql engine happens to open another connection and you've only
75+
specified ":memory:", that connection will see a brand new database. A
76+
workaround is to use "file::memory:?mode=memory&cache=shared". Every
77+
connection to this string will point to the same in-memory database. See
78+
#204 for more info.
79+
7180
License
7281
-------
7382

0 commit comments

Comments
 (0)