Changeset: fbe0fd8a9dfa for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fbe0fd8a9dfa
Added Files:
        sql/test/bugs/Tests/emili.sql
        sql/test/bugs/Tests/emili.stable.err
        sql/test/bugs/Tests/emili.stable.out
Modified Files:
        sql/test/bugs/Tests/All
Branch: Feb2013
Log Message:

added test for problem with create functions errors not being
returned properly (reported by Martin sometime ago).


diffs (191 lines):

diff --git a/sql/test/bugs/Tests/All b/sql/test/bugs/Tests/All
--- a/sql/test/bugs/Tests/All
+++ b/sql/test/bugs/Tests/All
@@ -103,3 +103,4 @@ create_insert_select_aggr-bug-00001
 procedure_resolution_bug
 correlated_update_bug
 polymorphism
+emili
diff --git a/sql/test/bugs/Tests/emili.sql b/sql/test/bugs/Tests/emili.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/emili.sql
@@ -0,0 +1,53 @@
+start transaction;
+--This one compiles
+
+create table istream(
+               ip int, 
+               location varchar(16), 
+               kind int,
+               value int);
+create table sensors(
+               ip int, 
+               location varchar(16), 
+               kind int,
+               value int);
+create table area(
+               ip int, 
+               location varchar(16) );
+
+CREATE PROCEDURE enrich1()
+BEGIN
+     INSERT INTO sensors(ip, location, kind,value)
+         SELECT ip, substring(location,0,3), kind, value FROM istream;
+     IF TRUE
+     THEN
+         INSERT INTO area SELECT ip, substring(location,0,3) FROM istream;
+     END IF;
+END;
+
+--This one does not, see IF-expression, and does not produce an error message.
+
+CREATE PROCEDURE enrich2()
+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;
+
+--And this one works again:
+CREATE PROCEDURE enrich3()
+BEGIN
+     DECLARE cnt INTEGER;
+     SET cnt = (SELECT count(*) FROM area ) ;
+     INSERT INTO sensors(ip, location, kind,value)
+         SELECT ip, substring(location,0,3), kind, value FROM istream;
+     IF cnt = 0
+     THEN
+         INSERT INTO area SELECT ip, substring(location,0,3) FROM istream;
+     END IF;
+END;
+
+rollback;
diff --git a/sql/test/bugs/Tests/emili.stable.err 
b/sql/test/bugs/Tests/emili.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/emili.stable.err
@@ -0,0 +1,59 @@
+stderr of test 'emili` in directory 'sql/test/bugs` itself:
+
+
+# 19:14:59 >  
+# 19:14:59 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=32975" "--set" 
"mapi_usock=/var/tmp/mtest-15106/.s.monetdb.32975" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_bugs"
 "--set" "mal_listing=0"
+# 19:14:59 >  
+
+# builtin opt  gdk_dbpath = 
/home/niels/scratch/rc-clean/Linux-x86_64/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_vmtrim = yes
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 32975
+# cmdline opt  mapi_usock = /var/tmp/mtest-15106/.s.monetdb.32975
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbpath = 
/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_bugs
+# cmdline opt  mal_listing = 0
+
+# 19:14:59 >  
+# 19:14:59 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-15106" "--port=32975"
+# 19:14:59 >  
+
+MAPI  = (monetdb) /var/tmp/mtest-15106/.s.monetdb.32975
+QUERY = CREATE PROCEDURE enrich2()
+        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) /var/tmp/mtest-15106/.s.monetdb.32975
+QUERY = CREATE PROCEDURE enrich3()
+        BEGIN
+             DECLARE cnt INTEGER;
+             SET cnt = (SELECT count(*) FROM area ) ;
+             INSERT INTO sensors(ip, location, kind,value)
+                 SELECT ip, substring(location,0,3), kind, value FROM istream;
+             IF cnt = 0
+             THEN
+                 INSERT INTO area SELECT ip, substring(location,0,3) FROM 
istream;
+             END IF;
+        END;
+ERROR = !current transaction is aborted (please ROLLBACK)
+
+# 19:14:59 >  
+# 19:14:59 >  "Done."
+# 19:14:59 >  
+
diff --git a/sql/test/bugs/Tests/emili.stable.out 
b/sql/test/bugs/Tests/emili.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/emili.stable.out
@@ -0,0 +1,56 @@
+stdout of test 'emili` in directory 'sql/test/bugs` itself:
+
+
+# 19:14:59 >  
+# 19:14:59 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=32975" "--set" 
"mapi_usock=/var/tmp/mtest-15106/.s.monetdb.32975" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_bugs"
 "--set" "mal_listing=0"
+# 19:14:59 >  
+
+# MonetDB 5 server v11.15.4
+# This is an unreleased version
+# Serving database 'mTests_sql_test_bugs', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 3.778 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2013 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://niels.nesco.mine.nu:32975/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-15106/.s.monetdb.32975
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 19:14:59 >  
+# 19:14:59 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-15106" "--port=32975"
+# 19:14:59 >  
+
+#start transaction;
+#create table istream(
+#              ip int, 
+#              location varchar(16), 
+#              kind int,
+#              value int);
+#create table sensors(
+#              ip int, 
+#              location varchar(16), 
+#              kind int,
+#              value int);
+#create table area(
+#              ip int, 
+#              location varchar(16) );
+#CREATE PROCEDURE enrich1()
+#BEGIN
+#     INSERT INTO sensors(ip, location, kind,value)
+#         SELECT ip, substring(location,0,3), kind, value FROM istream;
+#     IF TRUE
+#     THEN
+#         INSERT INTO area SELECT ip, substring(location,0,3) FROM istream;
+#     END IF;
+#END;
+#rollback;
+
+# 19:14:59 >  
+# 19:14:59 >  "Done."
+# 19:14:59 >  
+
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to