Changeset: dd746dee68f6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dd746dee68f6
Modified Files:
        sql/backends/monet5/sql.mx
        sql/backends/monet5/sql_optimizer.c
        sql/common/sql_types.c
        sql/server/rel_optimizer.c
        sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.stable.out
Branch: default
Log Message:

Merged from Dec2011


diffs (172 lines):

diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx
--- a/sql/backends/monet5/sql.mx
+++ b/sql/backends/monet5/sql.mx
@@ -4294,11 +4294,14 @@ bat@2_2time_@1( int *res, int *bid, int 
        BATaccessBegin(b, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
        BATloop(b,p,q) {
                @3 *v = (@3*)BUNtail(bi,p);
-               @1 r;
-               msg = @2_2time_@1( &r, @4, digits );
+               union {
+                       lng l;
+                       @1 r;
+               } u;
+               msg = @2_2time_@1( &u.r, @4, digits );
                if (msg)
                        break;
-               BUNins(dst, BUNhead(bi,p), &r, FALSE);
+               BUNins(dst, BUNhead(bi,p), &u.r, FALSE);
        }
        BATaccessEnd(b, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
        BBPkeepref( *res = dst->batCacheid);
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
@@ -388,6 +388,9 @@ is_subtype(sql_subtype *sub, sql_subtype
                return 0;
        if (super->digits > 0 && sub->digits > super->digits) 
                return 0;
+       if (super->digits == 0 && super->type->eclass == EC_STRING && 
+           (sub->type->eclass == EC_STRING || sub->type->eclass == EC_CHAR))
+               return 1;
        /* subtypes are only equal iff
           they map onto the same systemtype */
        return (type_cmp(sub->type, super->type) == 0);
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
@@ -547,14 +547,19 @@ find_one_rel(list *rels, sql_exp *e)
 static int
 joinexp_cmp(list *rels, sql_exp *h, sql_exp *key)
 {
-       sql_rel *h_l = find_rel(rels, h->l);
-       sql_rel *h_r = find_rel(rels, h->r);
-       sql_rel *key_l = find_rel(rels, key->l);
-       sql_rel *key_r  = find_rel(rels, key->r);
+       sql_rel *h_l;
+       sql_rel *h_r;
+       sql_rel *key_l;
+       sql_rel *key_r;
 
        assert (!h || !key || (h->type == e_cmp && key->type == e_cmp));
        if (is_complex_exp(h->flag) || is_complex_exp(key->flag))
                return -1;
+       h_l = find_rel(rels, h->l);
+       h_r = find_rel(rels, h->r);
+       key_l = find_rel(rels, key->l);
+       key_r  = find_rel(rels, key->r);
+
        if (h_l == key_l && h_r == key_r)
                return 0;
        if (h_r == key_l && h_l == key_r)
diff --git a/sql/storage/store_dependency.c b/sql/storage/store_dependency.c
--- a/sql/storage/store_dependency.c
+++ b/sql/storage/store_dependency.c
@@ -131,9 +131,15 @@ sql_trans_get_dependency_type(sql_trans 
        dep_dep_type = find_sql_column(dep, "depend_type");
 
        rid = table_funcs.column_find_row(tr, dep_id, &id, dep_dep_type, 
&depend_type, NULL);
-       if (rid != oid_nil)     
-               return *(int *) table_funcs.column_find_value(tr, dep_dep_id, 
rid);
-       else return -1;
+       if (rid != oid_nil) {   
+               int r, *v = table_funcs.column_find_value(tr, dep_dep_id, rid);
+
+               r = *v;
+               _DELETE(v);
+               return r;
+       } else {
+               return -1;
+       }
 }
 
 /*It checks if there are dependency between two ID's */
diff --git 
a/sql/test/BugTracker-2010/Tests/mat.slice_limit1.Bug-2645.stable.out 
b/sql/test/BugTracker-2010/Tests/mat.slice_limit1.Bug-2645.stable.out
--- a/sql/test/BugTracker-2010/Tests/mat.slice_limit1.Bug-2645.stable.out
+++ b/sql/test/BugTracker-2010/Tests/mat.slice_limit1.Bug-2645.stable.out
@@ -115,7 +115,7 @@ Ready.
 #TRACE select cast(x as string)||'-bla-'||cast(y as string) from slice_test 
limit 1;
 % sys. # table_name
 % concat_concat_x # name
-% clob # type
+% varchar # type
 % 7 # length
 [ "0-bla-1"    ]
 #SELECT count(*) FROM
diff --git a/sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.sql 
b/sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.sql
--- a/sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.sql
+++ b/sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.sql
@@ -27,3 +27,7 @@ WHERE
     ancestor.pre < _rank2.pre AND _rank2.pre < ancestor.post);
 
 DROP TABLE _rank2933;
+
+
+SELECT 123 AS dummy1 FROM tables n WHERE EXISTS ( SELECT 456 AS dummy2 FROM
+       (SELECT * FROM columns) nnn WHERE n.id > 0 );
diff --git a/sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.stable.out 
b/sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.stable.out
--- a/sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.stable.out
+++ b/sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.stable.out
@@ -83,6 +83,46 @@ Ready.
 % 1 # length
 [ 2    ]
 #DROP TABLE _rank2933;
+#SELECT 123 AS dummy1 FROM tables n WHERE EXISTS ( SELECT 456 AS dummy2 FROM
+#      (SELECT * FROM columns) nnn WHERE n.id > 0 );
+% . # table_name
+% dummy1 # name
+% tinyint # type
+% 3 # length
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
+[ 123  ]
 
 # 17:14:07 >  
 # 17:14:07 >  "Done."
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -1860,9 +1860,10 @@ def RunTest(env, TST, BusyPorts, COND, o
             # rename core file, if any -- might have to check
             # /proc/sys/kernel/core_pattern in the future but hopefully
             # this value is kept sane
-            if os.path.exists('core'):
+            corefile = os.path.join(env['GDK_DBFARM'], env['TSTDB'], 'core')
+            if os.path.exists(corefile):
                 try:
-                    os.rename('core', 'core-%s' % (TST))
+                    os.rename(corefile, '%s-%s' % (corefile, TST))
                 except:
                     pass
 
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to