From 554bca17f681b73cbcf8c25291c878b2b4e8d9b8 Mon Sep 17 00:00:00 2001 From: Vivek Menezes Date: Sat, 29 Apr 2017 16:56:47 -0400 Subject: [PATCH] sql: added a test case for multiple schema changes in a txn 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 --- pkg/sql/schema_changer_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/sql/schema_changer_test.go b/pkg/sql/schema_changer_test.go index 41d0a4735da8..99dcc08acad6 100644 --- a/pkg/sql/schema_changer_test.go +++ b/pkg/sql/schema_changer_test.go @@ -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`},