Update of /cvsroot/monetdb/sql/src/server
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24974/src/server
Modified Files:
sql_schema.mx
Log Message:
we should use the supplied schema name when we alter tables
Index: sql_schema.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_schema.mx,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- sql_schema.mx 27 Jan 2008 15:40:09 -0000 1.138
+++ sql_schema.mx 29 Jan 2008 22:04:29 -0000 1.139
@@ -1733,15 +1733,23 @@
}
static stmt *
-alter_table(mvc *sql, sql_schema *ss, dlist *qname, symbol *te)
+alter_table(mvc *sql, dlist *qname, symbol *te)
{
- char *name = qname_table(qname);
+ char *sname = qname_schema(qname);
+ char *tname = qname_table(qname);
+ sql_schema *s = NULL;
sql_table *t = NULL;
- if ((t = mvc_bind_table(sql, ss, name)) == NULL) {
- return sql_error(sql, 02, "ALTER TABLE: no such table '%s'",
name);
+ if (sname && !(s=mvc_bind_schema(sql, sname))) {
+ (void) sql_error(sql, 02, "ALTER TABLE: no such schema '%s'",
sname);
+ return NULL;
+ }
+ if (!s)
+ s = cur_schema(sql);
+ if ((t = mvc_bind_table(sql, s, tname)) == NULL) {
+ return sql_error(sql, 02, "ALTER TABLE: no such table '%s'",
tname);
} else {
- return table_element(sql, te, ss, t, 1);
+ return table_element(sql, te, s, t, 1);
}
}
@@ -1956,8 +1964,8 @@
{
dlist *l = s->data.lval;
- ret = alter_table(sql, cur_schema(sql), l->h->data.lval,
/* table name */
- l->h->next->data.sym); /* table
element */
+ ret = alter_table(sql, l->h->data.lval, /* table name */
+ l->h->next->data.sym);/* table element */
sql->type = Q_SCHEMA;
}
break;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins