Changeset: a278451b324c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a278451b324c
Modified Files:
        clients/odbc/driver/SQLExecDirect.c
        sql/server/rel_select.c
        sql/server/rel_updates.c
Branch: Dec2011
Log Message:

SQL: Added error codes for "no such table" and "no such column".


diffs (102 lines):

diff --git a/clients/odbc/driver/SQLExecDirect.c 
b/clients/odbc/driver/SQLExecDirect.c
--- a/clients/odbc/driver/SQLExecDirect.c
+++ b/clients/odbc/driver/SQLExecDirect.c
@@ -45,11 +45,6 @@ static struct errors {
        const char *msg;
 } errors[] = {
        {"syntax error", "42000"},
-       {"SELECT: no such table", "42S02"},
-       {"INSERT INTO: no such table", "42S02"},
-       {"DELETE FROM: no such table", "42S02"},
-       {"UPDATE: no such table", "42S02"},
-       {"CONSTRAINT FOREIGN KEY: no such table", "42S02"},
        {NULL, NULL},           /* sentinel */
 };
 
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -1576,7 +1576,7 @@ table_ref(mvc *sql, sql_rel *rel, symbol
                        }
                }
                if (!t && !temp_table) {
-                       return sql_error(sql, 02, "SELECT: no such table '%s'", 
tname);
+                       return sql_error(sql, 02, "42S02!SELECT: no such table 
'%s'", tname);
                } else if (!temp_table && !table_privs(sql, t, PRIV_SELECT)) {
                        return sql_error(sql, 02, "SELECT: access denied for %s 
to table '%s.%s'", stack_get_string(sql, "current_user"), s->base.name, tname);
                }
@@ -1733,7 +1733,7 @@ rel_column_ref(mvc *sql, sql_rel **rel, 
                        }
                }
                if (!exp)
-                       return sql_error(sql, 02, "SELECT: no such column 
'%s.%s'", tname, cname);
+                       return sql_error(sql, 02, "42S22!SELECT: no such column 
'%s.%s'", tname, cname);
        } else if (dlist_length(l) >= 3) {
                return sql_error(sql, 02, "TODO: column names of level >= 3");
        }
diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c
--- a/sql/server/rel_updates.c
+++ b/sql/server/rel_updates.c
@@ -326,7 +326,7 @@ insert_into(mvc *sql, dlist *qname, dlis
                        t = mvc_bind_table(sql, NULL, tname);
        }
        if (!t) {
-               return sql_error(sql, 02, "INSERT INTO: no such table '%s'", 
tname);
+               return sql_error(sql, 02, "42S02!INSERT INTO: no such table 
'%s'", tname);
        } else if (isView(t)) {
                return sql_error(sql, 02, "INSERT INTO: cannot insert into view 
'%s'", tname);
        } else if (t->readonly) {
@@ -348,7 +348,7 @@ insert_into(mvc *sql, dlist *qname, dlis
                        if (c) {
                                list_append(collist, c);
                        } else {
-                               return sql_error(sql, 02, "INSERT INTO: no such 
column '%s.%s'", tname, n->data.sval);
+                               return sql_error(sql, 02, "42S22!INSERT INTO: 
no such column '%s.%s'", tname, n->data.sval);
                        }
                }
        } else {
@@ -764,7 +764,7 @@ update_table(mvc *sql, dlist *qname, dli
                        t = tpe->comp_type;
        }
        if (!t) {
-               return sql_error(sql, 02, "UPDATE: no such table '%s'", tname);
+               return sql_error(sql, 02, "42S02!UPDATE: no such table '%s'", 
tname);
        } else if (isView(t)) {
                return sql_error(sql, 02, "UPDATE: cannot update view '%s'", 
tname);
        } else if (t->readonly) {
@@ -819,7 +819,7 @@ update_table(mvc *sql, dlist *qname, dli
 
                        if (!c) {
                                rel_destroy(r);
-                               return sql_error(sql, 02, "UPDATE: no such 
column '%s.%s'", t->base.name, cname);
+                               return sql_error(sql, 02, "42S22!UPDATE: no 
such column '%s.%s'", t->base.name, cname);
                        }
                        a = assignment->h->data.sym;
                        if (a) {
@@ -916,7 +916,7 @@ delete_table(mvc *sql, dlist *qname, sym
                }
        }
        if (!t) {
-               return sql_error(sql, 02, "DELETE FROM: no such table '%s'", 
tname);
+               return sql_error(sql, 02, "42S02!DELETE FROM: no such table 
'%s'", tname);
        } else if (isView(t)) {
                return sql_error(sql, 02, "DELETE FROM: cannot delete from view 
'%s'", tname);
        } else if (t->readonly) {
@@ -1034,7 +1034,7 @@ copyfrom(mvc *sql, dlist *qname, dlist *
                }
        }
        if (!t) 
-               return sql_error(sql, 02, "COPY INTO: no such table '%s'", 
tname);
+               return sql_error(sql, 02, "42S02!COPY INTO: no such table 
'%s'", tname);
        if (t->readonly) 
                return sql_error(sql, 02, "COPY INTO: cannot copy into read 
only table '%s'", tname);
        if (t && !isTempTable(t) && STORE_READONLY(active_store_type))
@@ -1145,7 +1145,7 @@ bincopyfrom(mvc *sql, dlist *qname, dlis
                }
        }
        if (!t) 
-               return sql_error(sql, 02, "COPY INTO: no such table '%s'", 
tname);
+               return sql_error(sql, 02, "42S02!COPY INTO: no such table 
'%s'", tname);
        if (t->readonly) 
                return sql_error(sql, 02, "COPY INTO: cannot copy into read 
only table '%s'", tname);
        if (t && !isTempTable(t) && STORE_READONLY(active_store_type))
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to