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

database/sql: On Drivers which don't implement ConnBeginTx, options are silently ignored with some Contexts. #21350

Closed
mattdee123 opened this issue Aug 8, 2017 · 1 comment

Comments

@mattdee123
Copy link

@mattdee123 mattdee123 commented Aug 8, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mdee/data/go_third_party_local:/Users/mdee/data/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rp/m0d1xlms1ts618xx3x1vgjp80000gp/T/go-build670327831=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

Used a sql.DB whose driver does not implement ConnBeginTx (in my case, an outdated version of pq), and begun a transaction with
db.BeginTx(context.TODO, &sql.TxOptions{ReadOnly: true}).

What did you expect to see?

I expected to see an error, since the driver does not support controlling ReadOnly or Isolation

What did you see instead?

This successfully opens a transaction which is not readonly. Similarly, any isolation levels will be ignored.

@gopherbot
Copy link

@gopherbot gopherbot commented Aug 8, 2017

Change https://golang.org/cl/53970 mentions this issue: database/sql: Fix bug where unsupported options were silently ignored.

@gopherbot gopherbot closed this in bd08803 Aug 9, 2017
@golang golang locked and limited conversation to collaborators Aug 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.