Changeset: 99f44904492c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=99f44904492c
Added Files:
        
sql/test/BugTracker-2019/Tests/remote-table-non-existent-column.Bug-6750.py
Modified Files:
        clients/odbc/driver/ODBCUtil.c
        sql/storage/store.c
        sql/test/BugTracker-2019/Tests/All
        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: default
Log Message:

Merge with Apr2019 branch.


diffs (211 lines):

diff --git a/clients/odbc/driver/ODBCUtil.c b/clients/odbc/driver/ODBCUtil.c
--- a/clients/odbc/driver/ODBCUtil.c
+++ b/clients/odbc/driver/ODBCUtil.c
@@ -799,6 +799,7 @@ ODBCTranslateSQL(ODBCDbc *dbc, const SQL
                                                        }
                                                }
                                                strcpy(q + pr, p);
+                                               length = pr + strlen(p);
                                                free(nquery);
                                                nquery = q;
                                                q += n;
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -6304,14 +6304,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/All 
b/sql/test/BugTracker-2019/Tests/All
--- a/sql/test/BugTracker-2019/Tests/All
+++ b/sql/test/BugTracker-2019/Tests/All
@@ -30,3 +30,4 @@ sequence-first-next-value.Bug-6743
 sequences-defaults.Bug-6744
 sequences-types.Bug-6745
 alter_table_drop_column.Bug-6749
+remote-table-non-existent-column.Bug-6750
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
diff --git 
a/sql/test/BugTracker-2019/Tests/remote-table-non-existent-column.Bug-6750.py 
b/sql/test/BugTracker-2019/Tests/remote-table-non-existent-column.Bug-6750.py
new file mode 100644
--- /dev/null
+++ 
b/sql/test/BugTracker-2019/Tests/remote-table-non-existent-column.Bug-6750.py
@@ -0,0 +1,58 @@
+import os
+import socket
+import sys
+import tempfile
+import shutil
+import pymonetdb
+
+try:
+    from MonetDBtesting import process
+except ImportError:
+    import process
+
+
+def freeport():
+    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+    sock.bind(('', 0))
+    port = sock.getsockname()[1]
+    sock.close()
+    return port
+
+
+farm_dir = tempfile.mkdtemp()
+
+prt1 = freeport()
+prc1 = process.server(mapiport=prt1, dbname='node1', 
dbfarm=os.path.join(farm_dir, 'node1'), stdin=process.PIPE, 
stdout=process.PIPE, stderr=process.PIPE)
+conn1 = pymonetdb.connect(database='node1', port=prt1, autocommit=True)
+cur1 = conn1.cursor()
+cur1.execute("start transaction;")
+cur1.execute("create table tab1 (col1 clob);")
+cur1.execute("insert into tab1 values ('a');")
+cur1.execute("create table tab2 (col1 tinyint);")
+cur1.execute("insert into tab2 values (1);")
+cur1.execute("commit;")
+cur1.close()
+conn1.close()
+
+prt2 = freeport()
+prc2 = process.server(mapiport=prt2, dbname='node2', 
dbfarm=os.path.join(farm_dir, 'node2'), stdin=process.PIPE, 
stdout=process.PIPE, stderr=process.PIPE)
+conn2 = pymonetdb.connect(database='node2', port=prt2, autocommit=True)
+cur2 = conn2.cursor()
+cur2.execute("start transaction;")
+cur2.execute("create remote table tab1 (col1 clob, col2 int) on 
'mapi:monetdb://localhost:"+str(prt1)+"/node1';")
+cur2.execute("create remote table tab2 (col1 double) on 
'mapi:monetdb://localhost:"+str(prt1)+"/node1';")
+cur2.execute("select col2 from tab1;")  # col2 doesn't exist
+cur2.execute("select col1 from tab2;")  # col1 is not a floating point column
+cur2.execute("rollback;")
+cur2.close()
+conn2.close()
+
+out, err = prc1.communicate()
+sys.stdout.write(out)
+sys.stderr.write(err)
+
+out, err = prc2.communicate()
+sys.stdout.write(out)
+sys.stderr.write(err)
+
+shutil.rmtree(farm_dir)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to