Changeset: 20f3bf441d1a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=20f3bf441d1a
Added Files:
        sql/test/BugTracker-2017/Tests/date-arithmetic.Bug-6415.stable.err
        sql/test/BugTracker-2017/Tests/date-arithmetic.Bug-6415.stable.out
Modified Files:
        clients/R/Tests/dbi.R
        sql/backends/monet5/Tests/rapi13.sql
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_upgrades.c
        sql/common/sql_types.c
        sql/server/rel_schema.c
        sql/server/rel_updates.c
        sql/test/BugDay_2005-10-06_2.9.3/Tests/set_types.SF-932360.sql
        
sql/test/BugDay_2005-12-19_2.9.3/Tests/cast_interval.SF.1280682.stable.err
        
sql/test/BugDay_2005-12-19_2.9.3/Tests/cast_interval.SF.1280682.stable.out
        sql/test/BugTracker-2011/Tests/default-interval.Bug-2877.sql
        
sql/test/BugTracker-2012/Tests/now_results_in_illegal_argument.Bug-2978.sql
        sql/test/BugTracker-2014/Tests/aggregates-intervals.Bug-3533.sql
        sql/test/BugTracker-2015/Tests/div_zero.Bug-3742.sql
        sql/test/BugTracker-2015/Tests/div_zero.Bug-3742.stable.out
        sql/test/BugTracker-2015/Tests/timestamp_convert.Bug-3815.sql
        sql/test/BugTracker-2015/Tests/timestamp_convert.Bug-3815.stable.out
        
sql/test/BugTracker-2016/Tests/column_name_lost_in_in_operator.Bug-6123.sql
        
sql/test/BugTracker-2016/Tests/column_name_lost_in_in_operator.Bug-6123.stable.out
        sql/test/BugTracker-2016/Tests/epoch.Bug-3979.sql
        sql/test/BugTracker-2016/Tests/select-in-from.Bug-6119.sql
        sql/test/BugTracker-2017/Tests/crash_on_NULL_ptr.Bug-6130.sql
        sql/test/BugTracker-2017/Tests/date-arithmetic.Bug-6415.sql
        sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.sql
        sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.err
        sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.out
        sql/test/SQLancer/Tests/sqlancer02.sql
        sql/test/SQLancer/Tests/sqlancer02.stable.err
        sql/test/SQLancer/Tests/sqlancer02.stable.out
        sql/test/bugs/Tests/interval_convert_bugs-sf-1274077-1274085.sql
        sql/test/bugs/Tests/interval_convert_bugs-sf-1274077-1274085.stable.err
        sql/test/bugs/Tests/interval_convert_bugs-sf-1274077-1274085.stable.out
        sql/test/emptydb/Tests/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.32bit
        sql/test/emptydb/Tests/check.stable.out.int128
        sql/test/lateral/Tests/lateral.sql
        sql/test/miscellaneous/Tests/simple_selects.sql
        sql/test/miscellaneous/Tests/simple_selects.stable.err
        sql/test/miscellaneous/Tests/simple_selects.stable.out
        sql/test/pg_regress/Tests/date.stable.err
        sql/test/pg_regress/Tests/date.stable.out
        sql/test/pg_regress/Tests/interval.stable.err.int128
        sql/test/pg_regress/Tests/interval.stable.out
        sql/test/pg_regress/Tests/interval.stable.out.int128
        sql/test/pg_regress/Tests/reltime.sql
        sql/test/pg_regress/Tests/time.stable.err
        sql/test/pg_regress/Tests/time.stable.out
        sql/test/pg_regress/Tests/timestamp.sql
        sql/test/pg_regress/Tests/timestamp.stable.err
        sql/test/pg_regress/Tests/timestamp.stable.out
        sql/test/pg_regress/Tests/timestamptz.sql
        sql/test/pg_regress/Tests/timestamptz.stable.err
        sql/test/pg_regress/Tests/timestamptz.stable.out
        sql/test/pg_regress/Tests/timetz.stable.err
        sql/test/pg_regress/Tests/timetz.stable.out
        sql/test/snodgrass/Tests/cast_select.sql
        sql/test/snodgrass/Tests/cast_select.stable.err
        sql/test/snodgrass/Tests/cast_select.stable.out
        sql/test/sys-schema/Tests/systemfunctions.stable.out
        sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: default
Log Message:

Major change. According to the SQL standard addition and subtraction between 
intervals and other number types is not allowed. The same applies for casting. 
This fixes bug 6910


diffs (truncated from 3319 to 300 lines):

diff --git a/clients/R/Tests/dbi.R b/clients/R/Tests/dbi.R
--- a/clients/R/Tests/dbi.R
+++ b/clients/R/Tests/dbi.R
@@ -193,7 +193,7 @@ stopifnot(identical("Роман Mühleisen", 
dbGetQuery(conn,"SELECT a FROM monetdbtest")$a[[1]]))
 dbRollback(conn)
 
 # this returns a column with esoteric type MONTH_INTERVAL
-stopifnot(identical(1L, as.integer(dbGetQuery(con, "select cast(1 as interval 
month) - cast(0 as interval month)")[[1]][[1]])))
+stopifnot(identical(1L, as.integer(dbGetQuery(con, "select interval '1' month 
+ interval '0' month")[[1]][[1]])))
 
 # reserved words in data frame column names
 stopifnot(dbIsValid(conn))
diff --git a/sql/backends/monet5/Tests/rapi13.sql 
b/sql/backends/monet5/Tests/rapi13.sql
--- a/sql/backends/monet5/Tests/rapi13.sql
+++ b/sql/backends/monet5/Tests/rapi13.sql
@@ -17,12 +17,12 @@ 2015-06-03 15:11:17.000000|2|"4006A4"|52
 2015-06-03 15:11:17.000000|2|"45AC45"|52.12491|6.03063|3.6e+04
 
 # three return columns works
-CREATE FUNCTION working_test(stt string, tss bigint, lat double, lon double, 
alt double) returns table (i int, j int, k int) language R {
+CREATE FUNCTION working_test(stt string, tss interval second, lat double, lon 
double, alt double) returns table (i int, j int, k int) language R {
        return(data.frame(1:10, 1:10, 1:10))
 };
 
 # but four does not? something to do with the amount of return columns?
-CREATE FUNCTION broken_test(stt string, tss bigint, lat double, lon double, 
alt double) returns table (i int, j int, k int, l int) language R {
+CREATE FUNCTION broken_test(stt string, tss interval second, lat double, lon 
double, alt double) returns table (i int, j int, k int, l int) language R {
        return(data.frame(1:10, 1:10, 1:10, 1:10))
 };
 
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -4567,17 +4567,8 @@ sql_delete_set_Fkeys(backend *be, sql_ke
 
                if (action == ACT_SET_DEFAULT) {
                        if (fc->c->def) {
-                               stmt *sq;
-                               char *msg, *typestr = 
subtype2string2(&fc->c->type);
-                               if(!typestr)
-                                       return sql_error(sql, 02, 
SQLSTATE(HY013) MAL_MALLOC_FAIL);
-                               msg = sa_message(sql->sa, "select cast(%s as 
%s);", fc->c->def, typestr);
-                               _DELETE(typestr);
-                               sq = rel_parse_value(be, msg, sql->emode);
-                               if (!sq)
-                                       return NULL;
-                               upd = sq;
-                       }  else {
+                               upd = rel_parse_value(be, sa_message(sql->sa, 
"select %s;", fc->c->def), sql->emode);
+                       } else {
                                upd = stmt_atom(be, atom_general(sql->sa, 
&fc->c->type, NULL));
                        }
                } else {
@@ -4630,16 +4621,7 @@ sql_update_cascade_Fkeys(backend *be, sq
                        upd = updates[c->c->colnr];
                } else if (action == ACT_SET_DEFAULT) {
                        if (fc->c->def) {
-                               stmt *sq;
-                               char *msg, *typestr = 
subtype2string2(&fc->c->type);
-                               if(!typestr)
-                                       return sql_error(sql, 02, 
SQLSTATE(HY013) MAL_MALLOC_FAIL);
-                               msg = sa_message(sql->sa, "select cast(%s as 
%s);", fc->c->def, typestr);
-                               _DELETE(typestr);
-                               sq = rel_parse_value(be, msg, sql->emode);
-                               if (!sq)
-                                       return NULL;
-                               upd = sq;
+                               upd = rel_parse_value(be, sa_message(sql->sa, 
"select %s;", fc->c->def), sql->emode);
                        } else {
                                upd = stmt_atom(be, atom_general(sql->sa, 
&fc->c->type, NULL));
                        }
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -316,7 +316,6 @@ create_table_or_view(mvc *sql, char* sna
                sql_column *c = n->data;
 
                if (c->def) {
-                       char *buf, *typestr;
                        sql_rel *r = NULL;
                        list *id_l;
 
@@ -325,21 +324,7 @@ create_table_or_view(mvc *sql, char* sna
                                sql->sa = osa;
                                throw(SQL, "sql.catalog",SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
                        }
-                       buf = sa_alloc(sql->sa, strlen(c->def) + 8);
-                       if (!buf) {
-                               sa_destroy(sql->sa);
-                               sql->sa = osa;
-                               throw(SQL, "sql.catalog",SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
-                       }
-                       typestr = subtype2string2(&c->type);
-                       if (!typestr) {
-                               sa_destroy(sql->sa);
-                               sql->sa = osa;
-                               throw(SQL, "sql.catalog",SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
-                       }
-                       snprintf(buf, BUFSIZ, "select cast(%s as %s);", c->def, 
typestr);
-                       _DELETE(typestr);
-                       r = rel_parse(sql, s, buf, m_deps);
+                       r = rel_parse(sql, s, sa_message(sql->sa, "select %s;", 
c->def), m_deps);
                        if (!r || !is_project(r->op) || !r->exps || 
list_length(r->exps) != 1 ||
                                rel_check_type(sql, &c->type, r, 
r->exps->h->data, type_equal) == NULL) {
                                if (r)
diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -2980,18 +2980,35 @@ sql_update_default(Client c, mvc *sql, c
                                        "DROP FUNCTION 
\"sys\".\"getcontent\"(url);\n"
                                        "DROP AGGREGATE 
\"json\".\"output\"(json);\n");
 
-                       /* Move sys.degrees and sys.radians to sql_types.c 
definitions */
+                       /* Move sys.degrees and sys.radians to sql_types.c 
definitions (I did this at the bat_logger) Remove the obsolete entries at 
privileges table */
+                       pos += snprintf(buf + pos, bufsize - pos,
+                                       "delete from privileges where obj_id in 
(select obj_id from privileges left join functions on privileges.obj_id = 
functions.id where functions.id is null and privileges.obj_id not in ((SELECT 
tables.id from tables), 0));\n");
+                       /* Remove sql_add and sql_sub between interval and 
numeric types */
                        pos += snprintf(buf + pos, bufsize - pos,
-                                       "delete from args where args.id in 
(select args.id from args left join functions on args.func_id = functions.id 
where args.name in ('r', 'd') and functions.id is null);\n"
-                                       "delete from privileges where obj_id in 
(select obj_id from privileges left join functions on privileges.obj_id = 
functions.id where functions.id is null and privileges.obj_id not in ((SELECT 
tables.id from tables), 0));\n");
+                                       "delete from functions where name in 
('sql_sub','sql_add') and func in ('+','-') and id in (select func_id from args 
where name = 'res_0' and type in ('sec_interval','month_interval'));\n");
+                       /* Remove arguments with no function correspondent */
+                       pos += snprintf(buf + pos, bufsize - pos,
+                                       "delete from args where id in (select 
args.id from args left join functions on args.func_id = functions.id where 
functions.id is null);\n");
 
-                       sql_subtype *types[2] = {sql_bind_localtype("flt"), 
sql_bind_localtype("dbl")};
                        list *functions = sa_list(sql->sa);
+                       /* Adding fixed versions of degrees and radians 
functions */
+                       sql_subtype *flt_types[2] = {sql_bind_localtype("flt"), 
sql_bind_localtype("dbl")};
                        for (int i = 0; i < 2; i++) {
-                               sql_subtype *next = types[i];
+                               sql_subtype *next = flt_types[i];
                                list_append(functions, sql_create_func(sql->sa, 
"degrees", "mmath", "degrees", FALSE, FALSE, SCALE_FIX, 0, next->type, 1, 
next->type));
                                list_append(functions, sql_create_func(sql->sa, 
"radians", "mmath", "radians", FALSE, FALSE, SCALE_FIX, 0, next->type, 1, 
next->type));
                        }
+
+                       /* Adding 'sql_sub' and 'sql_add' between interval 
types only */
+                       sql_subtype sec, month;
+                       sql_find_subtype(&sec, "sec_interval", 13, SCALE_FIX);
+                       sql_find_subtype(&month, "month_interval", 32, 0);
+                       sql_subtype *interval_types[2] = {&sec, &month};
+                       for (int i = 0; i < 2; i++) {
+                               sql_subtype *next = interval_types[i];
+                               list_append(functions, sql_create_func(sql->sa, 
"sql_sub", "calc", "-", FALSE, FALSE, SCALE_FIX, 0, next->type, 2, next->type, 
next->type));
+                               list_append(functions, sql_create_func(sql->sa, 
"sql_add", "calc", "+", FALSE, FALSE, SCALE_FIX, 0, next->type, 2, next->type, 
next->type));
+                       }
                        insert_functions(sql->session->tr, mvc_bind_table(sql, 
sys, "functions"), functions, mvc_bind_table(sql, sys, "args"));
 
                        pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", prev_schema);
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -102,11 +102,11 @@ static int convert_matrix[EC_MAX][EC_MAX
 /* EC_CHAR */          { 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
2 },
 /* EC_STRING */                { 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
2, 2, 2, 2 },
 /* EC_BLOB */          { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0 },
-/* EC_POS */           { 0, 0, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 
0 },
-/* EC_NUM */           { 0, 0, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 
0 },
-/* EC_MONTH*/          { 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 
0 },
-/* EC_SEC*/            { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 
0 },
-/* EC_DEC */           { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 
0 },
+/* EC_POS */           { 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 
0 },
+/* EC_NUM */           { 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 
0 },
+/* EC_MONTH*/          { 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0 },
+/* EC_SEC*/                    { 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 
0, 0, 0, 0 },
+/* EC_DEC */           { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 
0 },
 /* EC_FLT */           { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 
0 },
 /* EC_TIME */          { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 
0 },
 /* EC_TIME_TZ */       { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 
0 },
@@ -1667,18 +1667,21 @@ sqltypeinit( sql_allocator *sa)
                /* scale fixing for all numbers */
                sql_create_func(sa, "scale_up", "calc", "*", FALSE, FALSE, 
SCALE_NONE, 0, *t, 2, *t, lt->type);
                sql_create_func(sa, "scale_down", "sql", "dec_round", FALSE, 
FALSE, SCALE_NONE, 0, *t, 2, *t, lt->type);
-               /* numeric function on INTERVALS */
-               if (*t != MONINT && *t != SECINT){
-                       sql_create_func(sa, "sql_sub", "calc", "-", FALSE, 
FALSE, SCALE_FIX, 0, MONINT, 2, MONINT, *t);
-                       sql_create_func(sa, "sql_add", "calc", "+", FALSE, 
FALSE, SCALE_FIX, 0, MONINT, 2, MONINT, *t);
+               /* numeric functions on INTERVALS */
+               if (*t != MONINT && *t != SECINT) {
                        sql_create_func(sa, "sql_mul", "calc", "*", FALSE, 
FALSE, SCALE_MUL, 0, MONINT, 2, MONINT, *t);
                        sql_create_func(sa, "sql_div", "calc", "/", FALSE, 
FALSE, SCALE_DIV, 0, MONINT, 2, MONINT, *t);
-                       sql_create_func(sa, "sql_sub", "calc", "-", FALSE, 
FALSE, SCALE_FIX, 0, SECINT, 2, SECINT, *t);
-                       sql_create_func(sa, "sql_add", "calc", "+", FALSE, 
FALSE, SCALE_FIX, 0, SECINT, 2, SECINT, *t);
                        sql_create_func(sa, "sql_mul", "calc", "*", FALSE, 
FALSE, SCALE_MUL, 0, SECINT, 2, SECINT, *t);
                        sql_create_func(sa, "sql_div", "calc", "/", FALSE, 
FALSE, SCALE_DIV, 0, SECINT, 2, SECINT, *t);
                }
        }
+
+       /* numeric functions on INTERVALS */
+       for (t = dates; *t != TME; t++) {
+               sql_create_func(sa, "sql_sub", "calc", "-", FALSE, FALSE, 
SCALE_FIX, 0, *t, 2, *t, *t);
+               sql_create_func(sa, "sql_add", "calc", "+", FALSE, FALSE, 
SCALE_FIX, 0, *t, 2, *t, *t);
+       }
+
        for (t = decimals, t++; t != floats; t++) {
                sql_type **u;
                for (u = numerical; u != floats; u++) {
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
@@ -1572,13 +1572,7 @@ sql_alter_table(sql_query *query, dlist 
                for (node *n = nt->columns.nelm; n; n = n->next) {
                        sql_column *c = n->data;
                        if (c->def) {
-                               char *d, *typestr = subtype2string2(&c->type);
-                               if (!typestr)
-                                       return sql_error(sql, 02, 
SQLSTATE(HY013) MAL_MALLOC_FAIL);
-                               d = sql_message("select cast(%s as %s);", 
c->def, typestr);
-                               _DELETE(typestr);
-                               e = rel_parse_val(sql, d, sql->emode, NULL);
-                               _DELETE(d);
+                               e = rel_parse_val(sql, sa_message(sql->sa, 
"select %s;", c->def), sql->emode, NULL);
                        } else {
                                e = exp_atom(sql->sa, atom_general(sql->sa, 
&c->type, NULL));
                        }
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
@@ -29,12 +29,7 @@ insert_value(sql_query *query, sql_colum
                return exp_atom(sql->sa, atom_general(sql->sa, &c->type, NULL));
        } else if (s->token == SQL_DEFAULT) {
                if (c->def) {
-                       sql_exp *e;
-                       char *typestr = subtype2string2(&c->type);
-                       if(!typestr)
-                               return sql_error(sql, 02, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
-                       e = rel_parse_val(sql, sa_message(sql->sa, "select 
cast(%s as %s);", c->def, typestr), sql->emode, NULL);
-                       _DELETE(typestr);
+                       sql_exp *e = rel_parse_val(sql, sa_message(sql->sa, 
"select %s;", c->def), sql->emode, NULL);
                        if (!e || (e = rel_check_type(sql, &c->type, r ? *r : 
NULL, e, type_equal)) == NULL)
                                return sql_error(sql, 02, SQLSTATE(HY005) "%s: 
default expression could not be evaluated", action);
                        return e;
@@ -347,12 +342,7 @@ rel_inserts(mvc *sql, sql_table *t, sql_
                                                sql_exp *e = NULL;
 
                                                if (c->def) {
-                                                       char *q, *typestr = 
subtype2string2(&c->type);
-                                                       if(!typestr)
-                                                               return 
sql_error(sql, 02, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-                                                       q = sa_message(sql->sa, 
"select cast(%s as %s);", c->def, typestr);
-                                                       _DELETE(typestr);
-                                                       e = rel_parse_val(sql, 
q, sql->emode, NULL);
+                                                       e = rel_parse_val(sql, 
sa_message(sql->sa, "select %s;", c->def), sql->emode, NULL);
                                                        if (!e || (e = 
rel_check_type(sql, &c->type, r, e, type_equal)) == NULL)
                                                                return 
sql_error(sql, 02, SQLSTATE(HY005) "%s: default expression could not be 
evaluated", action);
                                                } else {
@@ -943,18 +933,14 @@ update_generate_assignments(sql_query *q
 
                        if (single && a->token == SQL_DEFAULT) {
                                char *colname = assignment->h->next->data.sval;
-                               sql_column *col = mvc_bind_column(sql, t, 
colname);
+                               sql_column *c = mvc_bind_column(sql, t, 
colname);
 
-                               if (!col)
+                               if (!c)
                                        return sql_error(sql, 02, 
SQLSTATE(42S22) "%s: no such column '%s.%s'", action, t->base.name, colname);
-                               if (col->def) {
-                                       char *typestr = 
subtype2string2(&col->type);
-                                       if (!typestr)
-                                               return sql_error(sql, 02, 
SQLSTATE(HY013) MAL_MALLOC_FAIL);
-                                       v = rel_parse_val(sql, 
sa_message(sql->sa, "select cast(%s as %s);", col->def, typestr), sql->emode, 
NULL);
-                                       _DELETE(typestr);
+                               if (c->def) {
+                                       v = rel_parse_val(sql, 
sa_message(sql->sa, "select %s;", c->def), sql->emode, NULL);
                                } else {
-                                       return sql_error(sql, 02, 
SQLSTATE(42000) "%s: column '%s' has no valid default value", action, 
col->base.name);
+                                       return sql_error(sql, 02, 
SQLSTATE(42000) "%s: column '%s' has no valid default value", action, 
c->base.name);
                                }
                        } else if (single) {
                                v = rel_value_exp(query, &r, a, sql_sel | 
sql_update_set, ek);
diff --git a/sql/test/BugDay_2005-10-06_2.9.3/Tests/set_types.SF-932360.sql 
b/sql/test/BugDay_2005-10-06_2.9.3/Tests/set_types.SF-932360.sql
--- a/sql/test/BugDay_2005-10-06_2.9.3/Tests/set_types.SF-932360.sql
+++ b/sql/test/BugDay_2005-10-06_2.9.3/Tests/set_types.SF-932360.sql
@@ -1,7 +1,7 @@
 set debug = 1;
 set debug = true;
-set current_timezone = 60;
+set current_timezone = interval '60' second;
 select current_timezone;
 set debug = false;
-set current_timezone = 0;
+set current_timezone = interval '0' second;
 select current_timezone;
diff --git 
a/sql/test/BugDay_2005-12-19_2.9.3/Tests/cast_interval.SF.1280682.stable.err 
b/sql/test/BugDay_2005-12-19_2.9.3/Tests/cast_interval.SF.1280682.stable.err
--- a/sql/test/BugDay_2005-12-19_2.9.3/Tests/cast_interval.SF.1280682.stable.err
+++ b/sql/test/BugDay_2005-12-19_2.9.3/Tests/cast_interval.SF.1280682.stable.err
@@ -5,6 +5,14 @@ stderr of test 'cast_interval.SF.1280682
 # 16:12:10 >  Mtimeout -timeout 180 Mserver 
"--config=/ufs/sjoerd/Monet-virgin/etc/MonetDB.conf" --debug=10 --set 
"monet_mod_path=/ufs/sjoerd/src/MonetDB/devel/sql-virgin/Linux/lib/MonetDB:/ufs/sjoerd/Monet-virgin/lib/MonetDB"
 --set "gdk_dbfarm=/ufs/sjoerd/Monet-virgin/var/MonetDB/dbfarm" --set 
"sql_logdir=/ufs/sjoerd/Monet-virgin/var/MonetDB/log" --set mapi_port=30623 
--set sql_port=49284 --set xquery_port=58556 --set monet_prompt= --trace 
"--dbname=mTests_src_test_BugDay_2005-12-19_2.9.3" 
--dbinit="module(sql_server); sql_server_start();" ; echo ; echo Over..
 # 16:12:10 >  
 
+MAPI  = (monetdb) /var/tmp/mtest-438601/.s.monetdb.35318
+QUERY = select cast( 1 as interval year );
+ERROR = !types tinyint(1,0) and month_interval(1,0) are not equal
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-438601/.s.monetdb.35318
+QUERY = select cast( 1 as interval day );
+ERROR = !types tinyint(1,0) and sec_interval(4,0) are not equal
+CODE  = 42000
 
 # 16:12:10 >  
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to