Changeset: b2cb2b7fabe6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b2cb2b7fabe6 Modified Files: sql/backends/monet5/sql_cat.c sql/server/rel_schema.c sql/test/merge-partitions/Tests/mergepart01.stable.err Branch: Oct2020 Log Message:
Give a more descriptive error message diffs (44 lines): diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c --- a/sql/backends/monet5/sql_cat.c +++ b/sql/backends/monet5/sql_cat.c @@ -1716,8 +1716,10 @@ SQLrename_table(Client cntxt, MalBlkPtr throw(SQL, "sql.rename_table", SQLSTATE(42000) "ALTER TABLE: not possible to change schema of a declared table"); if (mvc_check_dependency(sql, t->base.id, TABLE_DEPENDENCY, NULL)) throw(SQL, "sql.rename_table", SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' (there are database objects which depend on it)", otable_name); - if (t->members.set || t->triggers.set) - throw(SQL, "sql.rename_table", SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' (there are database objects which depend on it)", otable_name); + if (!list_empty(t->members.set)) + throw(SQL, "sql.rename_table", SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' while it has children", otable_name); + if (!list_empty(t->triggers.set)) + throw(SQL, "sql.rename_table", SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' while it has triggers", otable_name); if (!(s = mvc_bind_schema(sql, nschema_name))) throw(SQL, "sql.rename_table", SQLSTATE(42S02) "ALTER TABLE: no such schema '%s'", nschema_name); if (!mvc_schema_privs(sql, s)) diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c --- a/sql/server/rel_schema.c +++ b/sql/server/rel_schema.c @@ -2622,8 +2622,10 @@ rel_set_table_schema(sql_query *query, c return sql_error(sql, 02, SQLSTATE(42000) "ALTER TABLE: not possible to change schema of a declared table"); if (mvc_check_dependency(sql, ot->base.id, TABLE_DEPENDENCY, NULL)) return sql_error(sql, 02, SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' (there are database objects which depend on it)", tname); - if (ot->members.set || ot->triggers.set) - return sql_error(sql, 02, SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' (there are database objects which depend on it)", tname); + if (!list_empty(ot->members.set)) + return sql_error(sql, 02, SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' while it has children", tname); + if (!list_empty(ot->triggers.set)) + return sql_error(sql, 02, SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' while it has triggers", tname); if (!(ns = mvc_bind_schema(sql, new_schema))) return sql_error(sql, 02, SQLSTATE(42S02) "ALTER TABLE: no such schema '%s'", new_schema); if (!mvc_schema_privs(sql, ns)) diff --git a/sql/test/merge-partitions/Tests/mergepart01.stable.err b/sql/test/merge-partitions/Tests/mergepart01.stable.err --- a/sql/test/merge-partitions/Tests/mergepart01.stable.err +++ b/sql/test/merge-partitions/Tests/mergepart01.stable.err @@ -51,7 +51,7 @@ ERROR = !DROP TABLE: unable to drop tabl CODE = 42000 MAPI = (monetdb) /var/tmp/mtest-29983/.s.monetdb.31668 QUERY = ALTER TABLE testme SET SCHEMA other_schema; --error, changing schema not allowed while with child tables -ERROR = !ALTER TABLE: unable to set schema of table 'testme' (there are database objects which depend on it) +ERROR = !ALTER TABLE: unable to set schema of table 'testme' while it has children CODE = 2BM37 MAPI = (monetdb) /var/tmp/mtest-29983/.s.monetdb.31668 QUERY = ALTER TABLE subtable1 SET SCHEMA other_schema; --error, changing the schema shouldn't be allowed while part of a merge table _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list