Changeset: d273f49f00b4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d273f49f00b4
Modified Files:
        sql/server/rel_unnest.c
        sql/test/SQLancer/Tests/sqlancer22.test
Branch: Jan2022
Log Message:

Don't generate duplicate expressions while pushing down


diffs (37 lines):

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
@@ -858,7 +858,7 @@ push_up_project(mvc *sql, sql_rel *rel, 
                                if (cexps) {
                                        sql_rel *p = l->l = rel_project( 
sql->sa, l->l,
                                                rel_projections(sql, l->l, 
NULL, 1, 1));
-                                       p->exps = list_merge(p->exps, cexps, 
(fdup)NULL);
+                                       p->exps = 
list_distinct(list_merge(p->exps, cexps, (fdup)NULL), (fcmp)exp_equal, 
(fdup)NULL);
                                        if (list_empty(nexps)) {
                                                rel->r = l; /* remove empty 
project */
                                        } else {
diff --git a/sql/test/SQLancer/Tests/sqlancer22.test 
b/sql/test/SQLancer/Tests/sqlancer22.test
--- a/sql/test/SQLancer/Tests/sqlancer22.test
+++ b/sql/test/SQLancer/Tests/sqlancer22.test
@@ -83,5 +83,21 @@ with x(x) as (select 4) select 2 > all(s
 ----
 0
 
+statement ok rowcount 0
+update t0 set c0 = (with x(x) as (select 3)
+select 79 from x join (select 1) as y(y) on v17.c0 <= -4 where x.x > 1) from 
t0 v17
+
+statement ok rowcount 1
+INSERT INTO t0 VALUES (1)
+
+statement ok rowcount 1
+update t0 set c0 = (with x(x) as (select 3)
+select 79 from x join (select 1) as y(y) on v17.c0 <= -4 where x.x > 1) from 
t0 v17
+
+query I nosort
+SELECT c0 FROM t0
+----
+NULL
+
 statement ok
 ROLLBACK
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to