-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
bugs when use attach database #511
Comments
Can you provide a test which will reproduce this. |
I have same problem |
Can you provide a |
I fixed it with the following hook:
|
I guess this issue is related to above.
|
@kac- Is this something we should investigate or should this be filled under programmers error ? |
@gjrtimmer I think that this inconsistency in behaviour for memory and file storage can be misleading. It took me more than hour to catch it in my simple code (I was investigating custom ~DAO most of time and searched for some typo). Example codes have Edit: https://github.com/go-sql-driver/mysql passes this test without an error |
@gjrtimmer looking at it from a perspective I think it should be filled under programmers fault. Maybe worth noting: for both Python's and Ruby's sqlite drivers there is no |
@kac- will update README |
@kac- THANK YOU SO MUCH! I've found a part of code where I had forgotten to do rows.Close(), fixed that and now it works with no issues! Background: I'm using sqlite3 in-memory DB to simulate an Oracle DB in integration test cases. To make it possible, I added custom processing of specific Oracle functions and statements via ConnectHook/RegisterFunc and regular expressions. |
This change allows driver implementations to manage resources in driver.Connector, e.g. to share the same underlying database handle between multiple connections. That is, it allows embedded databases with in-memory backends like SQLite and Genji to safely release the resources once the sql.DB is closed. This makes it possible to address oddities with in-memory stores in SQLite and Genji drivers without introducing too much complexity in the driver implementations. See also: - mattn/go-sqlite3#204 - mattn/go-sqlite3#511 - chaisql/chai#210
This change allows driver implementations to manage resources in driver.Connector, e.g. to share the same underlying database handle between multiple connections. That is, it allows embedded databases with in-memory backends like SQLite and Genji to safely release the resources once the sql.DB is closed. This makes it possible to address oddities with in-memory stores in SQLite and Genji drivers without introducing too much complexity in the driver implementations. See also: - mattn/go-sqlite3#204 - mattn/go-sqlite3#511 - chaisql/chai#210
This change allows driver implementations to manage resources in driver.Connector, e.g. to share the same underlying database handle between multiple connections. That is, it allows embedded databases with in-memory backends like SQLite and Genji to safely release the resources once the sql.DB is closed. This makes it possible to address oddities with in-memory stores in SQLite and Genji drivers without introducing too much complexity in the driver implementations. See also: - mattn/go-sqlite3#204 - mattn/go-sqlite3#511 - chaisql/chai#210 Fixes #41790 Change-Id: Idbd19763134438ed38288b9d44f16608e4e97fd7 GitHub-Last-Rev: 962c785 GitHub-Pull-Request: #41710 Reviewed-on: https://go-review.googlesource.com/c/go/+/258360 Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Trust: Emmanuel Odeke <emmanuel@orijtech.com> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org>
Another solution, at least for my use case, appears to be: db.SetMaxOpenConns(1) |
This needs to be enforced to one for our in memory database, otherwise `no such table` errors are creeping up. See mattn/go-sqlite3#511 for more details.
This needs to be enforced to one for our in memory database, otherwise `no such table` errors are creeping up. See mattn/go-sqlite3#511 for more details.
when I attach another database file, it usually wrong when operating tables in the attach database.
For example, I use this command to attach a db:
attach database 'database/test4.db' as 'test4'
Then query from tables:
select * from test4.app_users
I restart my program a lot times to test. Sometimes I got error: no such table: test4.app_user. But sometimes it works!
I wonder if there some bugs with this sqlite3 driver about attach database.
The text was updated successfully, but these errors were encountered: