Skip to content

Commit

Permalink
sql: added a test case for multiple schema changes in a txn
Browse files Browse the repository at this point in the history
the test also includes an insert into an auxiliary table in the
same transaction as a way to record the schema change transaction.

fixes #15297
  • Loading branch information
vivekmenezes committed Apr 29, 2017
1 parent c43203c commit 7d11164
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/sql/schema_changer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1915,6 +1915,12 @@ INSERT INTO t.kv VALUES ('a', 'b');
// CREATE TABLE followed by INSERT works.
{`createtable-insert`, `CREATE TABLE t.origin (k CHAR PRIMARY KEY, v CHAR);`,
`INSERT INTO t.origin VALUES ('c', 'd')`, ``},
// Support multiple schema changes for ORMs: #15269
// Support insert into another table after schema changes: #15297
{`multiple-schema-change`,
`CREATE TABLE t.orm1 (k CHAR PRIMARY KEY, v CHAR); CREATE TABLE t.orm2 (k CHAR PRIMARY KEY, v CHAR);`,
`CREATE INDEX foo ON t.orm1 (v); CREATE INDEX foo ON t.orm2 (v); INSERT INTO t.origin VALUES ('e', 'f')`,
``},
// schema change at the end of a transaction that has written.
{`insert-create`, `INSERT INTO t.kv VALUES ('e', 'f')`, `CREATE INDEX foo ON t.kv (v)`,
`schema change statement cannot follow a statement that has written in the same transaction`},
Expand Down

0 comments on commit 7d11164

Please sign in to comment.