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

row.Scan fails when in a transaction #5

Closed
andrewzeneski opened this issue Jan 24, 2012 · 5 comments
Closed

row.Scan fails when in a transaction #5

andrewzeneski opened this issue Jan 24, 2012 · 5 comments

Comments

@andrewzeneski
Copy link

When inside a transaction I attempt to insert and then select the row that was just inserted; the row.Scan function fails with a nil pointer.

Here is the test case:
https://gist.github.com/1672440

[signal 0xb code=0x0 addr=0x0 pc=0x2193dec]

goroutine 1 [chan receive]:
testing.RunTests(0x2000, 0x161cc0, 0x200000002, 0x22c5f01, 0x22c5f28, ...)
    /Users/jaz/Sandbox/go/src/pkg/testing/testing.go:330 +0x795
testing.Main(0x2000, 0x161cc0, 0x200000002, 0x16d978, 0x0, ...)
    /Users/jaz/Sandbox/go/src/pkg/testing/testing.go:265 +0x62
main.main()
    /Users/jaz/Dropbox/projects/disco/pkg/txtest/_testmain.go:31 +0x91

goroutine 3 [syscall]:
github.com/mattn/go-sqlite3._Cfunc_sqlite3_column_name(0x2304240, 0x0)
    /Users/jaz/Sandbox/go-libs/go-sqlite3/_obj/_cgo_defun.c:122 +0x2f
github.com/mattn/go-sqlite3.(*SQLiteRows).Columns(0xf84000e060, 0xf8400215a8, 0x22c6d68, 0x18)
    /Users/jaz/Sandbox/go-libs/go-sqlite3/_obj/sqlite3.cgo1.go:-99 +0x8a
database/sql.(*Rows).Next(0xf840028180, 0x2285020, 0x1552e, 0x86a9)
    /Users/jaz/Sandbox/go/src/pkg/database/sql/sql.go:765 +0x81
database/sql.(*Row).Scan(0xf84000e040, 0x22c6e88, 0x100000001, 0x0, 0x0, ...)
    /Users/jaz/Sandbox/go/src/pkg/database/sql/sql.go:869 +0x9c
txtest.TestSqliteScanInTx(0xf840000150, 0x283a81f8)
    /Users/jaz/Dropbox/projects/disco/pkg/txtest/tx_test.go:61 +0x4c0
testing.tRunner(0xf840000150, 0x161cd8, 0x0, 0x0)
    /Users/jaz/Sandbox/go/src/pkg/testing/testing.go:254 +0x5f
created by testing.RunTests
    /Users/jaz/Sandbox/go/src/pkg/testing/testing.go:329 +0x772
gotest: "./6.out" failed: exit status 2
make: *** [test] Error 2
@bytbox
Copy link
Contributor

bytbox commented Jan 24, 2012

I encountered this too; I believe this may be due to a database/sql bug: see https://groups.google.com/forum/#!topic/golang-nuts/lHwLhWcDNkE. Not sure, and so haven't filed an issue with go.

@andrewzeneski
Copy link
Author

I've seen this issue with pq.go (pure go PostgreSQL lib) but not with gopgsqldriver, which seems to work as expected. I wonder if the author there found a workaround. I'll keep my eye on that topic, thanks for the pointer.

@bytbox
Copy link
Contributor

bytbox commented Jan 24, 2012

If you've seen this issue in independently developed code, it's almost certainly a database/sql bug, and you should file in the issue tracker. (At the very least, there's a quirk that needs to be addressed in the documentation.)

@andrewzeneski
Copy link
Author

Looks like you're right; there was confirmation from Brad. Closing this issue.

@mattn
Copy link
Owner

mattn commented Jan 26, 2012

@andrewzeneski

If this is a problem of go-sqlite3, please re-open this issue. Thanks. :)

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

3 participants