From ded1ba664d474b6bcf93a3a978aceef0bd9d9f20 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Thu, 26 Jan 2017 14:55:07 -0700 Subject: [PATCH] add a FAQ entry about :memory: races Closes #204 Closes #309 Signed-off-by: Tycho Andersen --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index a875e31..a5379c3 100644 --- a/README.md +++ b/README.md @@ -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 -------