Changeset: c415af002157 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c415af002157 Modified Files: sql/backends/monet5/sql.mx sql/server/rel_schema.c sql/server/sql_mvc.c sql/test/BugConstraints/Tests/add_constraint_1643522.stable.err sql/test/BugConstraints/Tests/drop_column_1643542.stable.err sql/test/BugDay_2005-10-06_2.9.3/Tests/limit_in_create_view.SF-924448.stable.err sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.stable.err sql/test/BugTracker-2009/Tests/drop-sequence-crash.SF-2854195.stable.err sql/test/BugTracker/Tests/drop_schema_crash.SF-1504794.stable.err sql/test/mserver5-sql-readonly/Tests/mserver5-sql-readonly-table.stable.err sql/test/mserver5-sql-readonly/Tests/mserver5-sql-readonly-view.stable.err Branch: Apr2012 Log Message:
Merge with Dec2011 branch. diffs (truncated from 610 to 300 lines): diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx --- a/sql/backends/monet5/sql.mx +++ b/sql/backends/monet5/sql.mx @@ -2254,12 +2254,12 @@ drop_seq(mvc *sql, char *sname, char *na if (!s) s = cur_schema(sql); if (!(seq = find_sql_sequence(s, name))) { - return sql_message("DROP SEQUENCE: no such sequence '%s'", name); + return sql_message("42M35!DROP SEQUENCE: no such sequence '%s'", name); } else if (!schema_privs(sql->role_id, s)) { return sql_message("42000!DROP SEQUENCE: insufficient privileges for '%s' in schema '%s'", stack_get_string(sql, "current_user"), s->base.name); } if (mvc_check_dependency(sql, seq->base.id, BEDROPPED_DEPENDENCY, NULL)) - return sql_message("DROP SEQUENCE: unable to drop sequence %s (there are database objects which depend on it)\n", seq->base.name); + return sql_message("2B000!DROP SEQUENCE: unable to drop sequence %s (there are database objects which depend on it)\n", seq->base.name); sql_trans_drop_sequence(sql->session->tr, s, seq, 0); return NULL; @@ -2447,7 +2447,7 @@ SQLcatalog(Client cntxt, MalBlkPtr mb, M return msg; if (STORE_READONLY(active_store_type)) - return sql_message("SQLException:sql.catalog: schema statements cannot be executed on a readonly database."); + return sql_message("25006!schema statements cannot be executed on a readonly database."); switch (type) { case DDL_CREATE_SEQ: @@ -2462,7 +2462,7 @@ SQLcatalog(Client cntxt, MalBlkPtr mb, M if (getArgType(mb, pci, 4) == TYPE_lng) val = getArgReference(stk, pci, 4); if (val == NULL || *val == lng_nil) - msg = sql_message("ALTER SEQUENCE: cannot (re)start with NULL"); + msg = sql_message("42M36!ALTER SEQUENCE: cannot (re)start with NULL"); else msg = alter_seq(sql, sname, s, val); } break; @@ -2476,13 +2476,13 @@ SQLcatalog(Client cntxt, MalBlkPtr mb, M int auth_id = sql->role_id; if (name && (auth_id = sql_find_auth(sql, name)) < 0) { - msg = sql_message("CREATE SCHEMA: no such authorization '%s'", name); + msg = sql_message("42M32!CREATE SCHEMA: no such authorization '%s'", name); } if (sql->user_id != USER_MONETDB && sql->role_id != ROLE_SYSADMIN) { msg = sql_message("42000!CREATE SCHEMA: insufficient privileges for user '%s'", stack_get_string(sql, "current_user")); } if (mvc_bind_schema(sql, sname)) { - msg = sql_message("CREATE SCHEMA: name '%s' already in use", sname); + msg = sql_message("3F000!CREATE SCHEMA: name '%s' already in use", sname); } else { (void)mvc_create_schema(sql, sname, auth_id, sql->user_id); } @@ -2492,15 +2492,15 @@ SQLcatalog(Client cntxt, MalBlkPtr mb, M sql_schema *s = mvc_bind_schema(sql, sname); if (!s) { - msg = sql_message("DROP SCHEMA: name %s does not exist", sname); + msg = sql_message("3F000!DROP SCHEMA: name %s does not exist", sname); } else if (!schema_privs(sql->role_id, s)) { - msg = sql_message("DROP SCHEMA: access denied for %s to schema ;'%s'", stack_get_string(sql, "current_user"), s->base.name); + msg = sql_message("42000!DROP SCHEMA: access denied for %s to schema ;'%s'", stack_get_string(sql, "current_user"), s->base.name); } else if (s == cur_schema(sql)) { - msg = sql_message("DROP SCHEMA: cannot drop current schema"); + msg = sql_message("42000!DROP SCHEMA: cannot drop current schema"); } else if (strcmp(sname, "sys") == 0 || strcmp(sname, "tmp") == 0) { - msg = sql_message("DROP SCHEMA: access denied for '%s'", sname); + msg = sql_message("42000!DROP SCHEMA: access denied for '%s'", sname); } else if (sql_schema_has_user(sql, s)) { - msg = sql_message("DROP SCHEMA: unable to drop schema '%s' (there are database objects which depend on it", sname); + msg = sql_message("2BM37!DROP SCHEMA: unable to drop schema '%s' (there are database objects which depend on it", sname); } else { mvc_drop_schema(sql, s, action); } @@ -2538,10 +2538,10 @@ SQLcatalog(Client cntxt, MalBlkPtr mb, M case DDL_CREATE_TYPE: { char *impl = *(str*) getArgReference(stk, pci, 3); if (!mvc_create_type(sql, sql->session->schema, sname, 0, 0, 0, impl)) - msg = sql_message("CREATE TYPE: unknown external type '%s'", impl); + msg = sql_message("0D000!CREATE TYPE: unknown external type '%s'", impl); } break; case DDL_DROP_TYPE: { - msg = sql_message("DROP TYPE: not implemented ('%s')", sname); + msg = sql_message("0A000!DROP TYPE: not implemented ('%s')", sname); } break; case DDL_GRANT_ROLES: { char *auth = SaveArgReference(stk, pci, 3); 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 @@ -104,7 +104,7 @@ view_rename_columns( mvc *sql, char *nam break; } if (n || m) - return sql_error(sql, 02, "Column lists do not match"); + return sql_error(sql, 02, "M0M03!Column lists do not match"); (void)name; sq = rel_project(sql->sa, sq, l); set_processed(sq); @@ -274,11 +274,11 @@ column_constraint_type(mvc *sql, char *n sql_key *k; if (kt == pkey && t->pkey) { - (void) sql_error(sql, 02, "CONSTRAINT PRIMARY KEY: a table can have only one PRIMARY KEY\n"); + (void) sql_error(sql, 02, "42000!CONSTRAINT PRIMARY KEY: a table can have only one PRIMARY KEY\n"); return res; } if (name && mvc_bind_key(sql, ss, name)) { - (void) sql_error(sql, 02, "CONSTRAINT PRIMARY KEY: key %s already exists", name); + (void) sql_error(sql, 02, "42000!CONSTRAINT PRIMARY KEY: key %s already exists", name); return res; } k = (sql_key*)mvc_create_ukey(sql, t, name, kt); @@ -299,17 +299,17 @@ column_constraint_type(mvc *sql, char *n assert(n->next->next->next->type == type_int); /* if (isTempTable(t)) { - (void) sql_error(sql, 02, "CONSTRAINT: constraints on temporary tables are not supported\n"); + (void) sql_error(sql, 02, "42000!CONSTRAINT: constraints on temporary tables are not supported\n"); return res; } */ rt = _bind_table(t, ss, cur_schema(sql), rtname); if (!rt) { - (void) sql_error(sql, 02, "42S02!CONSTRAINT FOREIGN KEY: no such table table '%s'\n", rtname); + (void) sql_error(sql, 02, "42S02!CONSTRAINT FOREIGN KEY: no such table '%s'\n", rtname); return res; } if (name && mvc_bind_key(sql, ss, name)) { - (void) sql_error(sql, 02, "CONSTRAINT FOREIGN KEY: key %s already exists", name); + (void) sql_error(sql, 02, "42000!CONSTRAINT FOREIGN KEY: key '%s' already exists", name); return res; } @@ -324,7 +324,7 @@ column_constraint_type(mvc *sql, char *n rk = &rt->pkey->k; } if (!rk) { - (void) sql_error(sql, 02, "CONSTRAINT FOREIGN KEY: could not find referenced PRIMARY KEY in table %s\n", rtname); + (void) sql_error(sql, 02, "42000!CONSTRAINT FOREIGN KEY: could not find referenced PRIMARY KEY in table %s\n", rtname); return res; } fk = mvc_create_fkey(sql, t, name, fkey, rk, ref_actions & 255, (ref_actions>>8) & 255); @@ -340,7 +340,7 @@ column_constraint_type(mvc *sql, char *n } break; } if (res == SQL_ERR) { - (void) sql_error(sql, 02, "unknown constraint (" PTRFMT ")->token = %s\n", PTRFMTCAST s, token2string(s->token)); + (void) sql_error(sql, 02, "M0M03!unknown constraint (" PTRFMT ")->token = %s\n", PTRFMTCAST s, token2string(s->token)); } return res; } @@ -408,7 +408,7 @@ column_option( } break; } if (res == SQL_ERR) { - (void) sql_error(sql, 02, "unknown column option (" PTRFMT ")->token = %s\n", PTRFMTCAST s, token2string(s->token)); + (void) sql_error(sql, 02, "M0M03!unknown column option (" PTRFMT ")->token = %s\n", PTRFMTCAST s, token2string(s->token)); } return res; } @@ -450,7 +450,7 @@ table_foreign_key(mvc *sql, char *name, assert(n->next->next->next->next->type == type_int); if (name && mvc_bind_key(sql, ss, name)) { - sql_error(sql, 02, "Create Key failed, key %s already exists", name); + sql_error(sql, 02, "42000!Create Key failed, key '%s' already exists", name); return SQL_ERR; } if (n->next->next->data.lval) { /* find unique referenced key */ @@ -467,7 +467,7 @@ table_foreign_key(mvc *sql, char *name, rk = &ft->pkey->k; } if (!rk) { - sql_error(sql, 02, "CONSTRAINT FOREIGN KEY: could not find referenced PRIMARY KEY in table '%s'\n", ft->base.name); + sql_error(sql, 02, "42000!CONSTRAINT FOREIGN KEY: could not find referenced PRIMARY KEY in table '%s'\n", ft->base.name); return SQL_ERR; } fk = mvc_create_fkey(sql, t, name, fkey, rk, ref_actions & 255, (ref_actions>>8) & 255); @@ -483,7 +483,7 @@ table_foreign_key(mvc *sql, char *name, mvc_create_fkc(sql, fk, c); } if (nms || fnms) { - sql_error(sql, 02, "CONSTRAINT FOREIGN KEY: not all columns are handled\n"); + sql_error(sql, 02, "42000!CONSTRAINT FOREIGN KEY: not all columns are handled\n"); return SQL_ERR; } } @@ -503,11 +503,11 @@ table_constraint_type(mvc *sql, char *na sql_key *k; if (kt == pkey && t->pkey) { - sql_error(sql, 02, "CONSTRAINT PRIMARY KEY: a table can have only one PRIMARY KEY\n"); + sql_error(sql, 02, "42000!CONSTRAINT PRIMARY KEY: a table can have only one PRIMARY KEY\n"); return SQL_ERR; } if (name && mvc_bind_key(sql, ss, name)) { - sql_error(sql, 02, "CONSTRAINT %s: key %s already exists", + sql_error(sql, 02, "42000!CONSTRAINT %s: key '%s' already exists", kt == pkey ? "PRIMARY KEY" : "UNIQUE", name); return SQL_ERR; } @@ -532,7 +532,7 @@ table_constraint_type(mvc *sql, char *na break; } if (!res) { - sql_error(sql, 02, "table constraint type: wrong token (" PTRFMT ") = %s\n", PTRFMTCAST s, token2string(s->token)); + sql_error(sql, 02, "M0M03!table constraint type: wrong token (" PTRFMT ") = %s\n", PTRFMTCAST s, token2string(s->token)); return SQL_ERR; } return res; @@ -556,7 +556,7 @@ table_constraint(mvc *sql, symbol *s, sq } if (!res) { - sql_error(sql, 02, "table constraint: wrong token (" PTRFMT ") = %s\n", PTRFMTCAST s, token2string(s->token)); + sql_error(sql, 02, "M0M03!table constraint: wrong token (" PTRFMT ") = %s\n", PTRFMTCAST s, token2string(s->token)); return SQL_ERR; } return res; @@ -573,7 +573,7 @@ create_column(mvc *sql, symbol *s, sql_s (void)ss; if (alter && !isTable(t)) { - sql_error(sql, 02, "ALTER TABLE: cannot add column to VIEW '%s'\n", t->base.name); + sql_error(sql, 02, "42000!ALTER TABLE: cannot add column to VIEW '%s'\n", t->base.name); return SQL_ERR; } if (l->h->next->next) @@ -593,7 +593,7 @@ create_column(mvc *sql, symbol *s, sql_s } if (res == SQL_ERR) - sql_error(sql, 02, "CREATE: column type or name"); + sql_error(sql, 02, "42000!CREATE: column type or name"); return res; } @@ -634,7 +634,7 @@ table_element(mvc *sql, symbol *s, sql_s msg = "drop constraint from"; break; } - sql_error(sql, 02, "ALTER TABLE: cannot %s %s '%s'\n", + sql_error(sql, 02, "42000!ALTER TABLE: cannot %s %s '%s'\n", msg, isMergeTable(t)?"MERGE TABLE": isReplicaTable(t)?"REPLICA TABLE":"VIEW", @@ -757,7 +757,7 @@ table_element(mvc *sql, symbol *s, sql_s return SQL_ERR; } if (!drop_action && mvc_check_dependency(sql, col->base.id, COLUMN_DEPENDENCY, NULL)) { - sql_error(sql, 02, "42000!ALTER TABLE: cannot drop column '%s': there are database objects which depend on it\n", cname); + sql_error(sql, 02, "2BM37!ALTER TABLE: cannot drop column '%s': there are database objects which depend on it\n", cname); return SQL_ERR; } if (!drop_action && t->keys.set) { @@ -768,7 +768,7 @@ table_element(mvc *sql, symbol *s, sql_s for (m = k->columns->h; m; m = m->next) { sql_kc *kc = m->data; if (strcmp(kc->c->base.name, cname) == 0) { - sql_error(sql, 02, "ALTER TABLE: cannot drop column '%s': there are constraints which depend on it\n", cname); + sql_error(sql, 02, "2BM37!ALTER TABLE: cannot drop column '%s': there are constraints which depend on it\n", cname); return SQL_ERR; } } @@ -780,7 +780,7 @@ table_element(mvc *sql, symbol *s, sql_s assert(0); } if (res == SQL_ERR) { - sql_error(sql, 02, "unknown table element (" PTRFMT ")->token = %s\n", PTRFMTCAST s, token2string(s->token)); + sql_error(sql, 02, "M0M03!unknown table element (" PTRFMT ")->token = %s\n", PTRFMTCAST s, token2string(s->token)); return SQL_ERR; } return res; @@ -822,7 +822,7 @@ rel_create_table(mvc *sql, sql_schema *s char *cd = (temp == SQL_DECLARED_TABLE)?"DECLARE":"CREATE"; return sql_error(sql, 02, "42S01!%s TABLE: name '%s' already in use", cd, name); } else if (temp != SQL_DECLARED_TABLE && (!schema_privs(sql->role_id, s) && !(isTempSchema(s) && temp == SQL_LOCAL_TEMP))){ - return sql_error(sql, 02, "CREATE TABLE: insufficient privileges for user '%s' in schema '%s'", stack_get_string(sql, "current_user"), s->base.name); + return sql_error(sql, 02, "42000!CREATE TABLE: insufficient privileges for user '%s' in schema '%s'", stack_get_string(sql, "current_user"), s->base.name); } else if (table_elements_or_subquery->token == SQL_CREATE_TABLE) { /* table element list */ sql_table *t = (tt == tt_remote)? @@ -893,7 +893,7 @@ rel_create_view(mvc *sql, sql_schema *ss if (create && mvc_bind_table(sql, s, name) != NULL) { return sql_error(sql, 02, "42S01!CREATE VIEW: name '%s' already in use", name); } else if (create && (!schema_privs(sql->role_id, s) && !(isTempSchema(s) && persistent == SQL_LOCAL_TEMP))) { - return sql_error(sql, 02, "CREATE VIEW: access denied for %s to schema ;'%s'", stack_get_string(sql, "current_user"), s->base.name); + return sql_error(sql, 02, "42000!CREATE VIEW: access denied for %s to schema ;'%s'", stack_get_string(sql, "current_user"), s->base.name); } else if (query) { sql_rel *sq = NULL; char *q = QUERY(sql->scanner); @@ -902,7 +902,7 @@ rel_create_view(mvc *sql, sql_schema *ss SelectNode *sn = (SelectNode *) query; if (sn->limit) - return sql_error(sql, 01, "42000!CREATE VIEW: LIMIT not supported"); + return sql_error(sql, 01, "0A000!42000!CREATE VIEW: LIMIT not supported"); if (sn->orderby) return sql_error(sql, 01, "42000!CREATE VIEW: ORDER BY not supported"); } _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list