-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
SQLite "cannot commit - no transaction is active" on large data sets #83
Comments
Thank you for a good issue. I think this error occurs because the query is too long.
I will verify and correct the correct value. |
I'm sorry. It is a misunderstanding. |
I added some debugging within database.go:
and called
The only difference between the first query that works and the second one that doesn't is the number of records inserted on the final iteration (Bulk insert 169). This might be an issue with the Question: Do you need to bother with a transaction at all for SQLite? Every execution of |
Can you try this patch?
I don't know why, but I noticed that it works fine except for stdin. |
Yes. sqlite3 requires a transaction. |
Your patch works!
dd if=/dev/urandom bs=10000000 count=1 |od -tx1 |sed 's/ /\x0a/g;' |
trdsql -oat 'select count(*) as RecCnt, c1 as Val from - group by c1 order by count(*) desc limit 5' Results:
|
Thank you for trying! |
Wrap os.Stdin with bufio.NewReader (Fix #83).
When a sufficiently large amount of data is passed to
trdsql
configured to use SQLite, an error is thrown indicating that there is no active transaction to commit.Here's a demonstration. Although pulling from /dev/urandom, the behavior was consistent. Worked fine for any number less than or equal to 78768, and threw the error for larger numbers. (I would not be surprised if the cutoff number were different in every environment though.)
I looked briefly at the relevant code but didn't see anything alarming...
The text was updated successfully, but these errors were encountered: