Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-memory mode doesn't support multiple queries #705

Closed
tonyyang-svail opened this issue Mar 29, 2019 · 3 comments
Closed

In-memory mode doesn't support multiple queries #705

tonyyang-svail opened this issue Mar 29, 2019 · 3 comments

Comments

@tonyyang-svail
Copy link

tonyyang-svail commented Mar 29, 2019

To reproduce

package main

import (
	"database/sql"
	_ "github.com/mattn/go-sqlite3"
)

func assertNoError(e error) {
	if e != nil {
		panic(e)
	}
}

func main() {
	db, e := sql.Open("sqlite3", ":memory:")
	assertNoError(e)
	_, e = db.Exec("create table my_table (class int);")
	assertNoError(e)
	_, e = db.Query("select * from my_table") // note that I didn't close the rows
	assertNoError(e)
	_, e = db.Query("select * from my_table") // error: no such table: my_table
	assertNoError(e)
}

I don't have this issue if the database is backed by a .db file.

@rittneje
Copy link
Collaborator

Known issue. Has to do with Go's connection pooling. See "Why I'm getting no such table error?" in the README.

@tonyyang-svail
Copy link
Author

@rittneje Thanks so much for the prompt reply!

@tonyyang-svail
Copy link
Author

Duplicate of #204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants