Changeset: ccf704516cc6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ccf704516cc6
Modified Files:
        sql/storage/store.c
        sql/test/BugTracker-2019/Tests/alter_table_drop_column.Bug-6749.py
        
sql/test/BugTracker-2019/Tests/alter_table_drop_column.Bug-6749.stable.out
Branch: Apr2019
Log Message:

More fixes for bug 6749 (i.e. when dropping a key, clean the key from the 
table's keyset only after removing the underlying storage information 
(dependant action))


diffs (129 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -6182,14 +6182,14 @@ sql_trans_drop_key(sql_trans *tr, sql_sc
        if (k->idx)
                sql_trans_drop_idx(tr, s, k->idx->base.id, drop_action);
 
+       if (!isTempTable(k->t)) 
+               sys_drop_key(tr, k, drop_action);
+
        /*Clean the key from the keys*/
        n = cs_find_name(&k->t->keys, k->base.name);
        if (n)
                cs_del(&k->t->keys, n, k->base.flags);
 
-       if (!isTempTable(k->t)) 
-               sys_drop_key(tr, k, drop_action);
-
        k->base.wtime = k->t->base.wtime = s->base.wtime = tr->wtime = 
tr->wstime;
        if (isGlobal(k->t)) 
                tr->schema_updates ++;
diff --git a/sql/test/BugTracker-2019/Tests/alter_table_drop_column.Bug-6749.py 
b/sql/test/BugTracker-2019/Tests/alter_table_drop_column.Bug-6749.py
--- a/sql/test/BugTracker-2019/Tests/alter_table_drop_column.Bug-6749.py
+++ b/sql/test/BugTracker-2019/Tests/alter_table_drop_column.Bug-6749.py
@@ -47,5 +47,24 @@ select idxs.type, idxs.name from idxs in
 server_stop(s)
 
 s = process.server(args = [], stdin = process.PIPE, stdout = process.PIPE, 
stderr = process.PIPE)
-client('drop table t;')
+client('''\
+drop table t;\
+start transaction;\
+create table t (a int, b int, c int);\
+alter table t add unique (b);\
+select * from t;\
+select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';\
+select count(*) from dependencies inner join columns on dependencies.id = 
columns.id inner join tables on columns.table_id = tables.id where tables.name 
= 't';\
+select keys.type, keys.name, keys.rkey, keys.action from keys inner join 
tables on tables.id = keys.table_id where tables.name = 't';\
+select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';\
+alter table t drop column b cascade;\
+select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';\
+select count(*) from dependencies inner join columns on dependencies.id = 
columns.id inner join tables on columns.table_id = tables.id where tables.name 
= 't';\
+select keys.type, keys.name, keys.rkey, keys.action from keys inner join 
tables on tables.id = keys.table_id where tables.name = 't';\
+select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';\
+select * from t;\
+commit;\
+select * from t;\
+drop table t;
+''')
 server_stop(s)
diff --git 
a/sql/test/BugTracker-2019/Tests/alter_table_drop_column.Bug-6749.stable.out 
b/sql/test/BugTracker-2019/Tests/alter_table_drop_column.Bug-6749.stable.out
--- a/sql/test/BugTracker-2019/Tests/alter_table_drop_column.Bug-6749.stable.out
+++ b/sql/test/BugTracker-2019/Tests/alter_table_drop_column.Bug-6749.stable.out
@@ -143,7 +143,74 @@ stdout of test 'alter_table_drop_column.
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-26192/.s.monetdb.30301
 # MonetDB/GIS module loaded
 # MonetDB/SQL module loaded
-#drop table t;
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+% sys.t,       sys.t,  sys.t # table_name
+% a,   b,      c # name
+% int, int,    int # type
+% 1,   1,      1 # length
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+% .L54 # table_name
+% L54 # name
+% bigint # type
+% 1 # length
+[ 2    ]
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+% .L54 # table_name
+% L54 # name
+% bigint # type
+% 1 # length
+[ 2    ]
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+% .keys,       .keys,  .keys,  .keys # table_name
+% type,        name,   rkey,   action # name
+% int, varchar,        int,    int # type
+% 1,   10,     2,      2 # length
+[ 1,   "t_b_unique",   -1,     -1      ]
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+% .idxs,       .idxs # table_name
+% type,        name # name
+% int, varchar # type
+% 1,   10 # length
+[ 0,   "t_b_unique"    ]
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+% .L54 # table_name
+% L54 # name
+% bigint # type
+% 1 # length
+[ 0    ]
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+% .L54 # table_name
+% L54 # name
+% bigint # type
+% 1 # length
+[ 0    ]
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+% .keys,       .keys,  .keys,  .keys # table_name
+% type,        name,   rkey,   action # name
+% int, varchar,        int,    int # type
+% 1,   0,      1,      1 # length
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+% .idxs,       .idxs # table_name
+% type,        name # name
+% int, varchar # type
+% 1,   0 # length
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+% sys.t,       sys.t # table_name
+% a,   c # name
+% int, int # type
+% 1,   1 # length
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
+% sys.t,       sys.t # table_name
+% a,   c # name
+% int, int # type
+% 1,   1 # length
+#drop table t;start transaction;create table t (a int, b int, c int);alter 
table t add unique (b);select * from t;select count(*) from objects inner join 
dependencies on objects.id = dependencies.depend_id inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select count(*) from dependencies inner join columns on 
dependencies.id = columns.id inner join tables on columns.table_id = tables.id 
where tables.name = 't';select keys.type, keys.name, keys.rkey, keys.action 
from keys inner join tables on tables.id = keys.table_id where tables.name = 
't';select idxs.type, idxs.name from idxs inner join tables on tables.id = 
idxs.table_id where tables.name = 't';alter table t drop column b 
cascade;select count(*) from objects inner join dependencies on objects.id = 
dependencies.depend_id inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select count
 (*) from dependencies inner join columns on dependencies.id = columns.id inner 
join tables on columns.table_id = tables.id where tables.name = 't';select 
keys.type, keys.name, keys.rkey, keys.action from keys inner join tables on 
tables.id = keys.table_id where tables.name = 't';select idxs.type, idxs.name 
from idxs inner join tables on tables.id = idxs.table_id where tables.name = 
't';select * from t;commit;select * from t;drop table t;
 # MonetDB 5 server v11.33.4 (hg id: 101e6463524a+)
 # This is an unreleased version
 # Serving database 'mTests_sql_test_BugTracker-2019', using 8 threads
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to