Changeset: 65528c4fc12c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=65528c4fc12c
Added Files:
        sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.sql
        sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.stable.err
        sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.stable.out
        sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.sql
        sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.stable.err
        sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.stable.out
Modified Files:
        sql/server/rel_optimizer.c
        sql/storage/store.c
        sql/test/BugTracker-2014/Tests/All
Branch: Jan2014
Log Message:

fixed drop of local temporary tables


diffs (271 lines):

diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -5604,7 +5604,7 @@ rel_rewrite_semijoin(int *changes, mvc *
                                sql_exp *le = NULL, *oe = n->data;
                                sql_exp *re = NULL, *ne = m->data;
                                sql_column *cl;  
-                               int anti = (rel->op == op_anti);
+                               int anti = (rel->op == op_anti), equal = 0;
                                
                                if (oe->type != e_cmp || ne->type != e_cmp ||
                                    oe->flag != cmp_equal || 
@@ -5622,15 +5622,15 @@ rel_rewrite_semijoin(int *changes, mvc *
 
                                if (exp_find_column(rl, ne->l, -2) == cl) {
                                        sql_exp *e = (or != r)?rel_find_exp(or, 
re):re;
-                                       int equal = exp_match_exp(ne->r, e);
-
+
+                                       equal = exp_match_exp(ne->r, e);
                                        if (anti && !equal)
                                                return rel;
                                        re = ne->r;
                                } else if (exp_find_column(rl, ne->r, -2) == 
cl) {
                                        sql_exp *e = (or != r)?rel_find_exp(or, 
re):re;
-                                       int equal = exp_match_exp(ne->l, e);
-
+
+                                       equal = exp_match_exp(ne->l, e);
                                        if (anti && !equal)
                                                return rel;
                                        re = ne->l;
@@ -5639,6 +5639,13 @@ rel_rewrite_semijoin(int *changes, mvc *
 
                                ne = exp_compare(sql->sa, le, re, cmp_equal);
                                append(exps, ne);
+                               if (!equal) {
+                                       re = (le==oe->r)?oe->l:oe->r;
+                                       re = (or != r)?rel_find_exp(or, re):re;
+                                       assert(0);
+                                       oe = exp_compare(sql->sa, le, re, 
cmp_equal);
+                                       append(exps, oe);
+                               }
                        }
 
                        rel->r = rel_dup(r->r);
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -160,6 +160,29 @@ schema_destroy(sql_schema *s)
        s->triggers = NULL;
 }
 
+static void
+trans_drop_tmp(sql_trans *tr) 
+{
+       sql_schema *tmp;
+
+       if (!tr)
+               return;
+
+       tmp = find_sql_schema(tr, "tmp");
+               
+       if (tmp->tables.set) {
+               node *n;
+               for (n = tmp->tables.set->h; n; ) {
+                       node *nxt = n->next;
+                       sql_table *t = n->data;
+
+                       if (t->persistence == SQL_LOCAL_TEMP)
+                               list_remove_node(tmp->tables.set, n);
+                       n = nxt;
+               }
+       }
+}
+
 /*#define STORE_DEBUG 1*/ 
 
 sql_trans *
@@ -176,6 +199,7 @@ sql_trans_destroy(sql_trans *t)
 #ifdef STORE_DEBUG
                fprintf(stderr, "#spared (%d) trans (%p)\n", spares, t);
 #endif
+               trans_drop_tmp(t);
                spare_trans[spares++] = t;
                return res;
        }
diff --git a/sql/test/BugTracker-2014/Tests/All 
b/sql/test/BugTracker-2014/Tests/All
--- a/sql/test/BugTracker-2014/Tests/All
+++ b/sql/test/BugTracker-2014/Tests/All
@@ -14,3 +14,6 @@ select-having.Bug-3458
 crash_on_or_with_in.Bug-3461
 in_incorrect_multi.Bug-3462
 crash_on_groupby_distinct_serial.Bug-3463
+local-temp-1.Bug-3468.sql 
+local-temp-2.Bug-3468.sql 
+
diff --git a/sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.sql 
b/sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.sql
@@ -0,0 +1,2 @@
+create local temporary table input (term int, p float) on commit preserve rows;
+insert into input values ( 1,0.1);
diff --git a/sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.stable.err 
b/sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'local-temp-1.Bug-3468` in directory 'sql/test/BugTracker-2014` 
itself:
+
+
+# 11:59:50 >  
+# 11:59:50 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34055" "--set" 
"mapi_usock=/var/tmp/mtest-17594/.s.monetdb.34055" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
 "--set" "mal_listing=0"
+# 11:59:50 >  
+
+# 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 = no
+# 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 = 34055
+# cmdline opt  mapi_usock = /var/tmp/mtest-17594/.s.monetdb.34055
+# 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_BugTracker-2014
+# cmdline opt  mal_listing = 0
+
+# 11:59:50 >  
+# 11:59:50 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-17594" "--port=34055"
+# 11:59:50 >  
+
+
+# 11:59:51 >  
+# 11:59:51 >  "Done."
+# 11:59:51 >  
+
diff --git a/sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.stable.out 
b/sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/local-temp-1.Bug-3468.stable.out
@@ -0,0 +1,35 @@
+stdout of test 'local-temp-1.Bug-3468` in directory 'sql/test/BugTracker-2014` 
itself:
+
+
+# 11:59:50 >  
+# 11:59:50 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34055" "--set" 
"mapi_usock=/var/tmp/mtest-17594/.s.monetdb.34055" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
 "--set" "mal_listing=0"
+# 11:59:50 >  
+
+# MonetDB 5 server v11.17.14
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2014', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 7.334 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://localhost.nes.nl:34055/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-17594/.s.monetdb.34055
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 11:59:50 >  
+# 11:59:50 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-17594" "--port=34055"
+# 11:59:50 >  
+
+#create local temporary table input (term int, p float) on commit preserve 
rows;
+#insert into input values ( 1,0.1);
+[ 1    ]
+
+# 11:59:51 >  
+# 11:59:51 >  "Done."
+# 11:59:51 >  
+
diff --git a/sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.sql 
b/sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.sql
@@ -0,0 +1,2 @@
+create local temporary table input (term int, p float) on commit preserve rows;
+insert into input values ( 1,0.1);
diff --git a/sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.stable.err 
b/sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'local-temp-2.Bug-3468` in directory 'sql/test/BugTracker-2014` 
itself:
+
+
+# 11:59:51 >  
+# 11:59:51 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34055" "--set" 
"mapi_usock=/var/tmp/mtest-17594/.s.monetdb.34055" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
 "--set" "mal_listing=0"
+# 11:59:51 >  
+
+# 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 = no
+# 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 = 34055
+# cmdline opt  mapi_usock = /var/tmp/mtest-17594/.s.monetdb.34055
+# 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_BugTracker-2014
+# cmdline opt  mal_listing = 0
+
+# 11:59:51 >  
+# 11:59:51 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-17594" "--port=34055"
+# 11:59:51 >  
+
+
+# 11:59:51 >  
+# 11:59:51 >  "Done."
+# 11:59:51 >  
+
diff --git a/sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.stable.out 
b/sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/local-temp-2.Bug-3468.stable.out
@@ -0,0 +1,35 @@
+stdout of test 'local-temp-2.Bug-3468` in directory 'sql/test/BugTracker-2014` 
itself:
+
+
+# 11:59:51 >  
+# 11:59:51 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34055" "--set" 
"mapi_usock=/var/tmp/mtest-17594/.s.monetdb.34055" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
 "--set" "mal_listing=0"
+# 11:59:51 >  
+
+# MonetDB 5 server v11.17.14
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2014', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 7.334 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://localhost.nes.nl:34055/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-17594/.s.monetdb.34055
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 11:59:51 >  
+# 11:59:51 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-17594" "--port=34055"
+# 11:59:51 >  
+
+#create local temporary table input (term int, p float) on commit preserve 
rows;
+#insert into input values ( 1,0.1);
+[ 1    ]
+
+# 11:59:51 >  
+# 11:59:51 >  "Done."
+# 11:59:51 >  
+
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to