Skip to content

Commit

Permalink
Merge #27047
Browse files Browse the repository at this point in the history
27047: sql-2.0: ensure that serializable means serializable r=knz a=knz

Prior to this patch SET transaction_isolation would always set the iso
level to SNAPSHOT regardless of the value passed. This patch fixes it.

Release note (bug fix): the pg-specific syntax `SET
transaction_isolation` did not support any setting other than SNAPSHOT
properly. (This bug did not affect the standard SQL `SET TRANSACTION
ISOLATION LEVEL`.) This is now fixed.

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
  • Loading branch information
craig[bot] and knz committed Jun 29, 2018
2 parents 2dd9fa6 + 89247fd commit ce128dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/txn
Expand Up @@ -255,6 +255,16 @@ SHOW transaction_isolation
----
snapshot

# Set it back and check it's kept properly.

statement ok
SET transaction_isolation = 'serializable'

query T
SHOW TRANSACTION ISOLATION LEVEL
----
serializable

statement ok
COMMIT

Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/sem/tree/txn.go
Expand Up @@ -40,7 +40,7 @@ var isolationLevelNames = [...]string{
// IsolationLevelMap is a map from string isolation level name to isolation
// level, in the lowercase format that set isolation_level supports.
var IsolationLevelMap = map[string]IsolationLevel{
"serializable": SnapshotIsolation,
"serializable": SerializableIsolation,
"snapshot": SnapshotIsolation,
}

Expand Down

0 comments on commit ce128dd

Please sign in to comment.