Changeset: 314dd0c57e32 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/314dd0c57e32
Added Files:
        sql/test/merge-partitions/Tests/mergepart34.test
Modified Files:
        sql/test/merge-partitions/Tests/All
Branch: Sep2022
Log Message:

simple test for leftover table_partitions/range_partitions


diffs (135 lines):

diff --git a/sql/test/merge-partitions/Tests/All 
b/sql/test/merge-partitions/Tests/All
--- a/sql/test/merge-partitions/Tests/All
+++ b/sql/test/merge-partitions/Tests/All
@@ -32,3 +32,4 @@ mergepart30
 mergepart31
 mergepart32
 mergepart33
+mergepart34
diff --git a/sql/test/merge-partitions/Tests/mergepart34.test 
b/sql/test/merge-partitions/Tests/mergepart34.test
new file mode 100644
--- /dev/null
+++ b/sql/test/merge-partitions/Tests/mergepart34.test
@@ -0,0 +1,122 @@
+
+statement ok
+CREATE MERGE TABLE table1 (a int) PARTITION BY RANGE ON (a)
+
+statement ok
+CREATE MERGE TABLE table2 (a int); 
+
+statement ok
+CREATE TABLE another1 (a int)
+
+statement ok
+CREATE TABLE another2 (a int)
+
+statement ok
+CREATE TABLE another3 (a int)
+
+statement ok
+ALTER TABLE table1 ADD TABLE another1 AS PARTITION FROM 10 TO 10
+
+statement ok
+ALTER TABLE table2 ADD TABLE another1 
+
+statement ok
+ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 11 TO 11
+
+statement ok
+ALTER TABLE table1 ADD TABLE another3 AS PARTITION FROM 12 TO 14
+
+query I rowsort
+select count(*) from sys._tables where name = 'table1'
+------
+1
+
+query I rowsort
+select count(*) from sys.objects where nr = ( select id from sys._tables where 
name = 'table1');
+------
+3
+
+query I rowsort
+select count(*) from table_partitions where table_id = (select id from 
sys._tables where name = 'table1')
+------
+1
+
+query I rowsort
+select count(*) from range_partitions where partition_id = (select id from 
table_partitions where table_id =  (select id from sys._tables where name = 
'table1'))
+------
+3
+
+statement ok
+ALTER TABLE table1 DROP TABLE another1
+
+query I rowsort
+select count(*) from range_partitions where partition_id = (select id from 
table_partitions where table_id =  (select id from sys._tables where name = 
'table1'))
+------
+2
+
+query I rowsort
+select count(*) from sys.objects where nr = ( select id from sys._tables where 
name = 'table1');
+------
+2
+
+statement ok
+ALTER TABLE table1 DROP TABLE another2
+
+query I rowsort
+select count(*) from range_partitions where partition_id = (select id from 
table_partitions where table_id =  (select id from sys._tables where name = 
'table1'))
+------
+1
+
+query I rowsort
+select count(*) from sys.objects where nr = ( select id from sys._tables where 
name = 'table1');
+------
+1
+
+statement ok
+ALTER TABLE table2 DROP TABLE another1
+
+statement ok
+DROP TABLE another1
+
+statement ok
+DROP TABLE another2
+
+statement error
+DROP TABLE another3
+
+query I rowsort
+select count(*) from range_partitions where partition_id = (select id from 
table_partitions where table_id =  (select id from sys._tables where name = 
'table1'))
+------
+1
+
+query I rowsort
+select count(*) from sys.objects where nr = ( select id from sys._tables where 
name = 'table1');
+------
+1
+
+statement ok
+ALTER TABLE table1 DROP TABLE another3
+
+query I rowsort
+select count(*) from range_partitions where partition_id = (select id from 
table_partitions where table_id =  (select id from sys._tables where name = 
'table1'))
+------
+0
+
+query I rowsort
+select count(*) from sys.objects where nr = ( select id from sys._tables where 
name = 'table1');
+------
+0
+
+statement ok
+DROP TABLE another3
+
+statement ok
+DROP TABLE table1
+
+query IIIII rowsort
+select * from table_partitions
+------
+
+query IIIII rowsort
+select * from range_partitions
+------
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to