Skip to content

Commit ae2e2d6

Browse files
committed
fix: v0.4.2 - remove ReadOnly flag from NOLOCK transaction (go-mssqldb unsupported)
1 parent 871b061 commit ae2e2d6

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.4.2] - 2026-02-18
9+
10+
### Fixed
11+
- **NOLOCK transaction error on `go-mssqldb`:** `executeQueryReadUncommitted` was opening the
12+
transaction with `sql.TxOptions{Isolation: sql.LevelReadUncommitted, ReadOnly: true}`. The
13+
`go-mssqldb` driver does not support the `ReadOnly` transaction flag and returned:
14+
`"read-only transactions are not supported"`. Removed `ReadOnly: true``READ UNCOMMITTED`
15+
isolation alone is sufficient: it prevents shared lock acquisition and the transaction is always
16+
rolled back via `defer tx.Rollback()` so no data is ever modified.
17+
818
## [0.4.1] - 2026-02-18
919

1020
### Fixed

pkg/adapter/mssql/mssql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ func (m *MSSQLAdapter) ExecuteProcedure(ctx context.Context, name string, params
639639
// executeQueryReadUncommitted runs the query inside a READ UNCOMMITTED transaction.// This is equivalent to appending WITH (NOLOCK) to every table reference.
640640
// The transaction is always rolled back afterwards since we only perform reads.
641641
func (m *MSSQLAdapter) executeQueryReadUncommitted(ctx context.Context, query string, args ...any) (*core.QueryResult, error) {
642-
tx, err := m.db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelReadUncommitted, ReadOnly: true})
642+
tx, err := m.db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelReadUncommitted})
643643
if err != nil {
644644
return nil, fmt.Errorf("failed to begin READ UNCOMMITTED transaction: %w", err)
645645
}

0 commit comments

Comments
 (0)