Changeset: ea66dd635065 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ea66dd635065
Modified Files:
        sql/backends/monet5/sql_gencode.c
        sql/test/miscellaneous/Tests/groupby_error.sql
        sql/test/miscellaneous/Tests/groupby_error.stable.err
Branch: linear-hashing
Log Message:

If a prepared statement parameter binds to the 'any' type, throw an error as it 
is not explicit


diffs (38 lines):

diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -792,7 +792,7 @@ backend_dumpproc(backend *be, Client c, 
                        sql_type *tpe = a->type.type;
                        int type, varid = 0;
 
-                       if (!tpe) {
+                       if (!tpe || tpe->eclass == EC_ANY) {
                                sql_error(m, 003, SQLSTATE(42000) "Could not 
determine type for argument number %d\n", argc+1);
                                goto cleanup;
                        }
diff --git a/sql/test/miscellaneous/Tests/groupby_error.sql 
b/sql/test/miscellaneous/Tests/groupby_error.sql
--- a/sql/test/miscellaneous/Tests/groupby_error.sql
+++ b/sql/test/miscellaneous/Tests/groupby_error.sql
@@ -42,6 +42,8 @@ prepare select case when col0 = 0 then ?
 prepare select case when col0 = 0 then ? when col0 = 1 then ? else 1 end from 
tab0;
 prepare select case when col0 = 0 then ? when col0 = 1 then ? else ? end from 
tab0; --error
 
+prepare select ? is null from tab0; --error
+
 CREATE TABLE tab1(col0 INTEGER, col1 STRING);
 prepare select 1 from tab1 where (col0,col1) in (select ?,? from tab1);
 
diff --git a/sql/test/miscellaneous/Tests/groupby_error.stable.err 
b/sql/test/miscellaneous/Tests/groupby_error.stable.err
--- a/sql/test/miscellaneous/Tests/groupby_error.stable.err
+++ b/sql/test/miscellaneous/Tests/groupby_error.stable.err
@@ -51,6 +51,10 @@ MAPI  = (monetdb) /var/tmp/mtest-128195/
 QUERY = prepare select case when col0 = 0 then ? when col0 = 1 then ? else ? 
end from tab0; --error
 ERROR = !Result type missing
 CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-143244/.s.monetdb.35226
+QUERY = prepare select ? is null from tab0; --error
+ERROR = !Could not determine type for argument number 1
+CODE  = 42000
 
 # 10:56:47 >  
 # 10:56:47 >  "Done."
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to