Changeset: 8bb7b1a8c62d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8bb7b1a8c62d
Modified Files:
        sql/server/rel_select.c
        sql/server/rel_unnest.c
        sql/server/rel_unnest.h
        sql/test/mergetables/Tests/sqlsmith-exists.stable.out
Branch: default
Log Message:

fixed problem with outer join expressions with subqueries


diffs (92 lines):

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
@@ -1074,6 +1074,8 @@ rel_column_ref(sql_query *query, sql_rel
                                        exp->card = CARD_ATOM;
                                set_freevar(exp, i);
                        }
+                       if (exp && outer && is_join(outer->op))
+                               set_dependent(outer);
                }
                if (exp) {
                        if (var || a)
@@ -1135,6 +1137,8 @@ rel_column_ref(sql_query *query, sql_rel
                                        exp->card = CARD_ATOM;
                                set_freevar(exp, i);
                        }
+                       if (exp && outer && is_join(outer->op))
+                               set_dependent(outer);
                }
 
                /* some views are just in the stack,
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -66,8 +66,6 @@ exps_set_freevar(mvc *sql, list *exps, s
                exp_set_freevar(sql, n->data, r);
 }
 
-static int exps_have_freevar(mvc *sql, list *exps);
-
 /* check if the set is distinct for the set of free variables */
 static int
 is_distinct_set(mvc *sql, sql_rel *rel, list *ad)
@@ -123,7 +121,7 @@ exp_has_freevar(mvc *sql, sql_exp *e)
        return 0;
 }
 
-static int
+int
 exps_have_freevar(mvc *sql, list *exps)
 {
        node *n;
diff --git a/sql/server/rel_unnest.h b/sql/server/rel_unnest.h
--- a/sql/server/rel_unnest.h
+++ b/sql/server/rel_unnest.h
@@ -13,6 +13,7 @@
 #include "sql_mvc.h"
 
 extern int exp_has_freevar(mvc *sql, sql_exp *e);
+extern int exps_have_freevar(mvc *sql, list *exps);
 extern int rel_has_freevar(mvc *sql, sql_rel *r);
 extern sql_rel *rel_unnest(mvc *sql, sql_rel *rel);
 extern void exps_set_freevar(mvc *sql, list *exps, sql_rel *r);
diff --git a/sql/test/mergetables/Tests/sqlsmith-exists.stable.out 
b/sql/test/mergetables/Tests/sqlsmith-exists.stable.out
--- a/sql/test/mergetables/Tests/sqlsmith-exists.stable.out
+++ b/sql/test/mergetables/Tests/sqlsmith-exists.stable.out
@@ -102,6 +102,35 @@ stdout of test 'sqlsmith-exists` in dire
 % c0,  c1,     c2,     c3,     c4,     c5 # name
 % int, int,    varchar,        int,    int,    varchar # type
 % 1,   1,      0,      1,      1,      0 # length
+#select 
+# subq_0.c0 as c0, 
+# subq_0.c0 as c1, 
+# cast(coalesce(4,
+# subq_0.c0) as int) as c2, 
+# case when subq_0.c0 is null then subq_0.c0 else subq_0.c0 end
+# as c3, 
+# subq_0.c0 as c4, 
+# subq_0.c0 as c5, 
+# subq_0.c0 as c6, 
+# subq_0.c0 as c7
+#from 
+# (select 
+# ref_4.type as c0
+# from 
+# sys.storagemodel as ref_0
+# right join sys.triggers as ref_1
+# right join sys.environment as ref_2
+# on (exists (
+# select 
+# ref_2.name as c0, 
+# ref_2.value as c1
+# from 
+# sys.dependency_owners_on_schemas as ref_3
+# where ref_1.table_id is null))
+% sys.%62,     sys.%63,        .%64,   sys.%65,        sys.%66,        
sys.%67,        sys.%70,        sys.%71 # table_name
+% c0,  c1,     c2,     c3,     c4,     c5,     c6,     c7 # name
+% int, int,    int,    int,    int,    int,    int,    int # type
+% 1,   1,      1,      1,      1,      1,      1,      1 # length
 #ROLLBACK;
 
 # 19:56:32 >  
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to