Skip to content

Commit

Permalink
sql: add test for rollback to savepoint with schema change
Browse files Browse the repository at this point in the history
related to cockroachdb#24785

Release note: None
  • Loading branch information
vivekmenezes committed Apr 16, 2018
1 parent 96295ac commit 1d92ac0
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/txn
Original file line number Diff line number Diff line change
Expand Up @@ -985,3 +985,57 @@ ROLLBACK
# restore the default
statement ok
SET default_transaction_read_only = false

subtest 24785

statement ok
BEGIN;

statement ok
SAVEPOINT cockroach_restart;

statement ok
CREATE TABLE users (
id INTEGER DEFAULT unique_rowid() NOT NULL,
uid VARCHAR,
passwordhash VARCHAR,
utype VARCHAR(7),
description VARCHAR,
is_remote BOOLEAN,
PRIMARY KEY (id),
UNIQUE (uid),
CONSTRAINT usertype CHECK (utype IN ('regular', 'service'))
);

statement ok
INSERT INTO users (uid, passwordhash, utype, description, is_remote) VALUES ('bootstrapuser', '$6$rounds=656000$Ddm1dA4kl0J7gsdN$wmBHwxTBCMHxgYDZ8hSFifdOyQWVmPxgAQPUojKC1uFdR3kVXFFLmXlxIhk.vlwrJ7KqHX5qHOSwOebP9VwBK/', 'regular', 'bootstrapuser', 'false') RETURNING users.id;

statement ok
ROLLBACK TO SAVEPOINT cockroach_restart;

statement ok
CREATE TABLE users (
id INTEGER DEFAULT unique_rowid() NOT NULL,
uid VARCHAR,
passwordhash VARCHAR,
utype VARCHAR(7),
description VARCHAR,
is_remote BOOLEAN,
PRIMARY KEY (id),
UNIQUE (uid),
CONSTRAINT usertype CHECK (utype IN ('regular', 'service'))
);

statement ok
INSERT INTO users (uid, passwordhash, utype, description, is_remote) VALUES ('bootstrapuser', '$6$rounds=656000$Ddm1dA4kl0J7gsdN$wmBHwxTBCMHxgYDZ8hSFifdOyQWVmPxgAQPUojKC1uFdR3kVXFFLmXlxIhk.vlwrJ7KqHX5qHOSwOebP9VwBK/', 'regular', 'bootstrapuser', 'false') RETURNING users.id;

statement ok
RELEASE SAVEPOINT cockroach_restart;

statement ok
COMMIT;

query TTTTB
select uid, passwordhash, utype, description, is_remote from users
----
bootstrapuser $6$rounds=656000$Ddm1dA4kl0J7gsdN$wmBHwxTBCMHxgYDZ8hSFifdOyQWVmPxgAQPUojKC1uFdR3kVXFFLmXlxIhk.vlwrJ7KqHX5qHOSwOebP9VwBK/ regular bootstrapuser false

0 comments on commit 1d92ac0

Please sign in to comment.