Changeset: 74ff3932c4ae for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=74ff3932c4ae
Modified Files:
sql/common/sql_types.c
sql/server/rel_psm.c
sql/server/rel_select.c
sql/test/BugTracker-2012/Tests/algebra_find.Bug-2728.sql
sql/test/BugTracker-2012/Tests/incorrect_cast_from_double_to_int.Bug-2579.stable.out
sql/test/BugTracker-2012/Tests/row_number_does_not_work_in_complex_query.Bug-2805.stable.out
sql/test/BugTracker-2012/Tests/timestamp_minus_date.Bug-2977.stable.err
sql/test/BugTracker-2012/Tests/type_resolution_error_in_SQL_procedural_code.Bug-3143.stable.err
Branch: default
Log Message:
Merge with Oct2012 branch.
diffs (188 lines):
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
@@ -100,7 +100,7 @@ static int convert_matrix[EC_MAX][EC_MAX
/* EC_DEC */ { 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
/* EC_FLT */ { 0, 0, 0, 1, 1, 0, 1, 3, 1, 1, 0, 0, 0, 0 },
/* EC_TIME */ { 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0 },
-/* EC_DATE */ { 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 3, 0 },
+/* EC_DATE */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 3, 0 },
/* EC_TSTAMP */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0 },
/* EC_EXTERNAL*/{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c
--- a/sql/server/rel_psm.c
+++ b/sql/server/rel_psm.c
@@ -227,8 +227,11 @@ psm_if_then_else( mvc *sql, sql_subtype
n = n->next;
elsestmts = psm_if_then_else( sql, res, n, is_func);
- if (sql->session->status || !cond || !ifstmts || rel)
+ if (sql->session->status || !cond || !ifstmts || rel) {
+ if (rel)
+ return sql_error(sql, 02, "IF THEN: No SELECT
statements allowed within the IF condition");
return NULL;
+ }
return append(sa_list(sql->sa), exp_if( sql->sa, cond, ifstmts,
elsestmts));
} else { /* else */
symbol *e = elseif->data.sym;
@@ -255,8 +258,11 @@ rel_psm_if_then_else( mvc *sql, sql_subt
ifstmts = sequential_block(sql, res, n->data.lval, NULL,
is_func);
n = n->next;
elsestmts = psm_if_then_else( sql, res, n, is_func);
- if (sql->session->status || !cond || !ifstmts || rel)
+ if (sql->session->status || !cond || !ifstmts || rel) {
+ if (rel)
+ return sql_error(sql, 02, "IF THEN ELSE: No
SELECT statements allowed within the IF condition");
return NULL;
+ }
return exp_if( sql->sa, cond, ifstmts, elsestmts);
}
return NULL;
@@ -295,8 +301,10 @@ rel_psm_case( mvc *sql, sql_subtype *res
exp_kind ek = {type_value, card_value, FALSE};
sql_exp *v = rel_value_exp(sql, &rel, case_value, sql_sel, ek);
- if (!v || rel)
+ if (!v)
return NULL;
+ if (rel)
+ return sql_error(sql, 02, "CASE: No SELECT statements
allowed within the CASE condition");
if (else_statements) {
else_stmt = sequential_block( sql, res,
else_statements, NULL, is_func);
if (!else_stmt)
@@ -311,8 +319,11 @@ rel_psm_case( mvc *sql, sql_subtype *res
if (!when_value || rel ||
(cond = rel_binop_(sql, v, when_value, NULL, "=",
card_value)) == NULL ||
- (if_stmts = sequential_block( sql, res,
m->next->data.lval, NULL, is_func)) == NULL )
+ (if_stmts = sequential_block( sql, res,
m->next->data.lval, NULL, is_func)) == NULL ) {
+ if (rel)
+ return sql_error(sql, 02, "CASE: No
SELECT statements allowed within the CASE condition");
return NULL;
+ }
case_stmt = exp_if(sql->sa, cond, if_stmts, NULL);
list_append(case_stmts, case_stmt);
n = n->next;
@@ -341,8 +352,11 @@ rel_psm_case( mvc *sql, sql_subtype *res
sql_exp *case_stmt = NULL;
if (!cond || rel ||
- (if_stmts = sequential_block( sql, res,
m->next->data.lval, NULL, is_func)) == NULL )
+ (if_stmts = sequential_block( sql, res,
m->next->data.lval, NULL, is_func)) == NULL ) {
+ if (rel)
+ return sql_error(sql, 02, "CASE: No
SELECT statements allowed within the CASE condition");
return NULL;
+ }
case_stmt = exp_if(sql->sa, cond, if_stmts, NULL);
list_append(case_stmts, case_stmt);
n = n->next;
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
@@ -3555,12 +3555,16 @@ rel_binop_(mvc *sql, sql_exp *l, sql_exp
if (l && r)
return exp_binop(sql->sa, l, r, f);
}
- }
- if (r && l)
- res = sql_error(sql, 02, "SELECT: no such binary operator
'%s(%s,%s)'",
- fname,
- exp_subtype(l)->type->sqlname,
- exp_subtype(r)->type->sqlname);
+ /* reset error */
+ sql->session->status = 0;
+ sql->errstr[0] = '\0';
+
+ l = ol;
+ r = or;
+ }
+ res = sql_error(sql, 02, "SELECT: no such binary operator '%s(%s,%s)'",
fname,
+ exp_subtype(l)->type->sqlname,
+ exp_subtype(r)->type->sqlname);
return res;
}
diff --git a/sql/test/BugTracker-2012/Tests/algebra_find.Bug-2728.sql
b/sql/test/BugTracker-2012/Tests/algebra_find.Bug-2728.sql
--- a/sql/test/BugTracker-2012/Tests/algebra_find.Bug-2728.sql
+++ b/sql/test/BugTracker-2012/Tests/algebra_find.Bug-2728.sql
@@ -29,3 +29,5 @@ insert into kvk values (1, 'test', 1, 0,
select count(*) from vve, kvk where toevoeging is null and vve.huisnummer is
not null and vve.postcode = kvk.postcode and kvk.adres like '
%'||vve.huisnummer;
+drop table kvk;
+drop table vve;
diff --git
a/sql/test/BugTracker-2012/Tests/incorrect_cast_from_double_to_int.Bug-2579.stable.out
b/sql/test/BugTracker-2012/Tests/incorrect_cast_from_double_to_int.Bug-2579.stable.out
---
a/sql/test/BugTracker-2012/Tests/incorrect_cast_from_double_to_int.Bug-2579.stable.out
+++
b/sql/test/BugTracker-2012/Tests/incorrect_cast_from_double_to_int.Bug-2579.stable.out
@@ -91,7 +91,7 @@ Ready.
% sql_div_single_value # name
% tinyint # type
% 1 # length
-[ 0.607 ]
+[ 0 ]
#SELECT '3.1'/5.1;
% . # table_name
% sql_div_single_value # name
diff --git
a/sql/test/BugTracker-2012/Tests/row_number_does_not_work_in_complex_query.Bug-2805.stable.out
b/sql/test/BugTracker-2012/Tests/row_number_does_not_work_in_complex_query.Bug-2805.stable.out
---
a/sql/test/BugTracker-2012/Tests/row_number_does_not_work_in_complex_query.Bug-2805.stable.out
+++
b/sql/test/BugTracker-2012/Tests/row_number_does_not_work_in_complex_query.Bug-2805.stable.out
@@ -254,7 +254,7 @@ Ready.
[ 1 ]
#with Raw as (select a,b,c,count(*) as value from T where e<10 and c<50 group
by a,b,c) select Raw.*, row_number() over (partition by a order by value desc)
from Raw;
% sys.raw, sys.raw, sys.raw, sys.raw, . # table_name
-% a, b, c, value, row_number_value # name
+% a, b, c, value, row_number_a # name
% int, int, int, wrd, int # type
% 1, 1, 1, 1, 1 # length
[ 7, 7, 7, 1, 1 ]
diff --git
a/sql/test/BugTracker-2012/Tests/timestamp_minus_date.Bug-2977.stable.err
b/sql/test/BugTracker-2012/Tests/timestamp_minus_date.Bug-2977.stable.err
--- a/sql/test/BugTracker-2012/Tests/timestamp_minus_date.Bug-2977.stable.err
+++ b/sql/test/BugTracker-2012/Tests/timestamp_minus_date.Bug-2977.stable.err
@@ -29,7 +29,9 @@ stderr of test 'timestamp_minus_date.Bug
# 13:51:42 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=warsaw"
"--port=39949"
# 13:51:42 >
-There should be a error message stating that SQL(-99) does not allow
arrithmetic between timestamps and dates.
+MAPI = monetdb@niels:34679
+QUERY = select (cast('1970-01-01 0:00' as timestamp) - cast('1970-01-01' as
date));
+ERROR = !SELECT: no such binary operator 'sql_sub(timestamp,date)'
# 13:51:43 >
# 13:51:43 > "Done."
diff --git
a/sql/test/BugTracker-2012/Tests/type_resolution_error_in_SQL_procedural_code.Bug-3143.stable.err
b/sql/test/BugTracker-2012/Tests/type_resolution_error_in_SQL_procedural_code.Bug-3143.stable.err
---
a/sql/test/BugTracker-2012/Tests/type_resolution_error_in_SQL_procedural_code.Bug-3143.stable.err
+++
b/sql/test/BugTracker-2012/Tests/type_resolution_error_in_SQL_procedural_code.Bug-3143.stable.err
@@ -25,15 +25,25 @@ stderr of test 'type_resolution_error_in
# cmdline opt gdk_dbname = mTests_test_BugTracker-2012
# cmdline opt mal_listing = 0
-# 15:17:51 >
-# 15:17:51 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=lyon"
"--port=35055"
-# 15:17:51 >
+# 16:19:02 >
+# 16:19:02 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=niels"
"--port=33753"
+# 16:19:02 >
-MAPI = monetdb@lyon:35055
-QUERY = HERE WE SHOULD HAVE A ERROR REPORTING THAT THE CREATION OF enrich_b()
FAILED;
-
-MAPI = monetdb@lyon:35055
+MAPI = monetdb@niels:33753
+QUERY = CREATE PROCEDURE enrich_b()
+ BEGIN
+ INSERT INTO sensors(ip, location, kind,value)
+ SELECT ip, substring(location,0,3), kind, value FROM istream;
+ IF (SELECT count(*) FROM area ) = 0
+ THEN
+ INSERT INTO area SELECT ip, substring(location,0,3) FROM
+ istream;
+ END IF;
+ END;
+ERROR = !IF THEN ELSE: No SELECT statements allowed within the IF condition
+MAPI = monetdb@niels:33753
QUERY = drop procedure enrich_b();
+ERROR = !DROP PROCEDURE: no such procedure 'enrich_b' ()
# 15:17:52 >
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list