Changeset: 24f8685ce20c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/24f8685ce20c
Modified Files:
        sql/server/rel_select.c
Branch: default
Log Message:

merged with aug2024


diffs (71 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
@@ -2842,8 +2842,10 @@ rel_logical_exp(sql_query *query, sql_re
                assert(quantifier == 0 || quantifier == 1 || quantifier == 2 || 
quantifier == 3 || quantifier == 4);
 
                if (quantifier >= 3) {
-                       if (quantifier == 4)
+                       if (quantifier == 4) {
                                is_distinct_from = true;
+                               compare_op = "<>";
+                       }
                        quantifier = 0;
                        is_semantics = 1;
                }
@@ -2859,6 +2861,7 @@ rel_logical_exp(sql_query *query, sql_re
                        bool rs_is_non_null_atom = exp_is_atom(rs) && 
exp_is_not_null(rs);
 
                        if (ls_is_non_null_atom || rs_is_non_null_atom) {
+                               sql_rel *r = rel_dup(rel);
                                sql_rel* l = rel_compare(query, rel, sc, lo, 
ro, compare_op, f | sql_or, ek, quantifier, 0);
                                sql_subtype *t;
                                if (!(t = 
exp_subtype(rs_is_non_null_atom?ls:rs)))
@@ -2866,9 +2869,10 @@ rel_logical_exp(sql_query *query, sql_re
                                sql_exp* e = exp_compare(sql->sa, 
rs_is_non_null_atom?ls:rs, exp_atom(sql->sa, atom_general(sql->sa, t, NULL, 
0)), cmp_equal);
                                set_has_no_nil(e);
                                set_semantics(e);
-                               sql_rel* r = 
rel_select_push_compare_exp_down(sql, rel, e, e->l, e->r, NULL, f | sql_or);
-
-                               return rel_or(sql, rel_dup(rel), l, r, NULL, 
NULL, NULL);
+
+                               r = rel_select_push_compare_exp_down(sql, r, e, 
e->l, e->r, NULL, f | sql_or);
+
+                               return rel_or(sql, rel, l, r, NULL, NULL, NULL);
                        }
                }
 
diff --git a/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test 
b/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test
@@ -0,0 +1,20 @@
+statement ok
+CREATE TABLE t0(c0 VARCHAR)
+
+statement ok
+INSERT INTO t0 (c0) VALUES ('a');
+
+query T
+SELECT t0.c0 FROM t0
+----
+a
+
+query T
+SELECT (1 AND ('' IS DISTINCT FROM t0.c0)) FROM t0
+----
+True
+
+query T
+SELECT t0.c0 FROM t0 WHERE (1 AND ('' IS DISTINCT FROM t0.c0))
+----
+a
diff --git a/sql/test/BugTracker-2024/Tests/All 
b/sql/test/BugTracker-2024/Tests/All
--- a/sql/test/BugTracker-2024/Tests/All
+++ b/sql/test/BugTracker-2024/Tests/All
@@ -61,4 +61,5 @@ 7513-uri-authority-parse-issue
 7514-wrong-window-function
 7524-right-outer-join
 7528-jarowinkler-null
+7534-is-distinct-from
 7535-create-view-groupby-func
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to