Changeset: 34a4476f66dc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/34a4476f66dc
Added Files:
        sql/test/mergetables/Tests/mergetable00.test
        sql/test/mergetables/Tests/mergetable01.test
Modified Files:
        sql/test/mergetables/Tests/All
Branch: Sep2022
Log Message:

add test reproducing mergetable create and drop (part) table issue


diffs (183 lines):

diff --git a/sql/test/mergetables/Tests/All b/sql/test/mergetables/Tests/All
--- a/sql/test/mergetables/Tests/All
+++ b/sql/test/mergetables/Tests/All
@@ -35,3 +35,6 @@ concurrent_merge_tables
 mergetabledependencies
 replicatabledependencies
 merge-tables-limitations
+
+mergetable00
+mergetable01
diff --git a/sql/test/mergetables/Tests/mergetable00.test 
b/sql/test/mergetables/Tests/mergetable00.test
new file mode 100644
--- /dev/null
+++ b/sql/test/mergetables/Tests/mergetable00.test
@@ -0,0 +1,100 @@
+@connection(id=1, username=monetdb, password=monetdb)                          
                                                       
+statement ok
+CREATE MERGE TABLE parent(a int)
+
+@connection(id=2, username=monetdb, password=monetdb)                          
                                                       
+statement ok
+CREATE TABLE child1(a int)
+
+@connection(id=2)
+statement ok rowcount 2
+INSERT INTO child1 VALUES (1),(2)
+
+@connection(id=2)
+statement ok
+CREATE TABLE child2(a int)
+
+@connection(id=2)
+statement ok rowcount 2
+INSERT INTO child2 VALUES (3),(4)
+
+@connection(id=2)
+statement ok
+CREATE TABLE child3(a int)
+
+@connection(id=2)
+statement ok rowcount 2
+INSERT INTO child3 VALUES (5),(6)
+
+@connection(id=1)
+statement ok
+alter table parent add table child1
+
+@connection(id=1)
+statement ok
+alter table parent add table child3
+
+@connection(id=2)
+statement ok
+start transaction
+
+@connection(id=1)
+statement ok
+start transaction
+
+@connection(id=1)
+statement ok
+alter table parent add table child2
+
+@connection(id=2)
+statement ok
+drop table child2;
+
+@connection(id=2)
+statement ok
+commit
+
+@connection(id=1)
+statement error
+commit
+
+@connection(id=1)
+query I nosort
+select * from parent
+----
+1
+2
+5
+6
+
+@connection(id=1)
+query I nosort
+select count(*) from sys.objects where nr = ( select id from sys._tables where 
name = 'parent');
+----
+2
+
+@connection(id=2)
+query I nosort
+select count(*) from sys.objects where nr = ( select id from sys._tables where 
name = 'parent');
+----
+2
+
+# cleanup 
+
+@connection(id=1)
+statement ok
+drop table parent;
+
+@connection(id=1)
+statement ok
+drop table child1;
+
+#@connection(id=1)
+#statement ok
+#drop table child2;
+
+@connection(id=1)
+statement ok
+drop table child3;
+
+
diff --git a/sql/test/mergetables/Tests/mergetable01.test 
b/sql/test/mergetables/Tests/mergetable01.test
new file mode 100644
--- /dev/null
+++ b/sql/test/mergetables/Tests/mergetable01.test
@@ -0,0 +1,63 @@
+@connection(id=2, username=monetdb, password=monetdb)                          
                                                       
+statement ok
+CREATE TABLE child1(a int)
+
+@connection(id=2)
+statement ok rowcount 2
+INSERT INTO child1 VALUES (1),(2)
+
+@connection(id=2)
+statement ok
+CREATE TABLE child2(a int)
+
+@connection(id=2)
+statement ok rowcount 2
+INSERT INTO child2 VALUES (3),(4)
+
+@connection(id=1, username=monetdb, password=monetdb)                          
                                                       
+statement ok
+start transaction
+
+@connection(id=1)
+statement ok
+CREATE MERGE TABLE parent(a int)
+
+@connection(id=2)
+statement ok
+start transaction
+
+@connection(id=1)
+statement ok
+alter table parent add table child1
+
+@connection(id=1)
+statement ok
+alter table parent add table child2
+
+@connection(id=2)
+statement ok
+drop table child2;
+
+@connection(id=2)
+statement ok
+commit
+
+@connection(id=1)
+query I nosort
+select count(*) from sys.objects where nr = ( select id from sys._tables where 
name = 'parent');
+----
+2
+
+# cleanup 
+
+@connection(id=1)
+statement ok
+drop table parent;
+
+@connection(id=1)
+statement ok
+drop table child1;
+
+#@connection(id=1)
+#statement ok
+#drop table child2;
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to