Changeset: dc85bc93b5b2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/dc85bc93b5b2 Added Files: sql/test/BugTracker-2021/Tests/unnest-union.Bug-7127.test Removed Files: sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.sql sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.sql sql/test/BugTracker-2021/Tests/unnest-union.Bug-7127.sql sql/test/BugTracker-2021/Tests/unnest-union.Bug-7127.stable.err sql/test/BugTracker-2021/Tests/unnest-union.Bug-7127.stable.out Modified Files: sql/server/rel_unnest.c sql/test/BugTracker-2021/Tests/All sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test Branch: Jul2021 Log Message:
Merged with Oct2020 diffs (132 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 @@ -1346,7 +1346,6 @@ push_up_set(mvc *sql, sql_rel *rel, list /* left of rel should be a set */ if (d && is_distinct_set(sql, d, ad) && s && is_set(s->op)) { - list *sexps; sql_rel *sl = s->l, *sr = s->r, *n; sl = rel_project(sql->sa, sl, rel_projections(sql, sl, NULL, 1, 1)); @@ -1363,12 +1362,11 @@ push_up_set(mvc *sql, sql_rel *rel, list s->l = rel; s->r = n; if (is_join(rel->op)) { - sexps = sa_list(sql->sa); - for (node *m = d->exps->h; m; m = m->next) { - sql_exp *e = m->data, *pe; - - pe = exp_ref(sql, e); - append(sexps, pe); + list *sexps = sa_list(sql->sa), *dexps = rel_projections(sql, d, NULL, 1, 1); + for (node *m = dexps->h; m; m = m->next) { + sql_exp *e = m->data; + + list_append(sexps, exp_ref(sql, e)); } s->exps = list_merge(sexps, s->exps, (fdup)NULL); } diff --git a/sql/test/BugTracker-2021/Tests/All b/sql/test/BugTracker-2021/Tests/All --- a/sql/test/BugTracker-2021/Tests/All +++ b/sql/test/BugTracker-2021/Tests/All @@ -7,5 +7,6 @@ merge-stmt.wrong-error.Bug-7109 remote-table-groupby.Bug-7110 conditional-execution-round.Bug-7125 lowercase-cryllic.Bug-7126 +unnest-union.Bug-7127 subquery-missing.Bug-7128 batcalc-between-undefined.Bug-7129 diff --git a/sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test b/sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test --- a/sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test +++ b/sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test @@ -4,12 +4,26 @@ start transaction statement ok create table t_qh ( c_f INTEGER , c_y2 INTEGER , primary key(c_f), unique(c_f) ) +statement ok rowcount 3 +insert into t_qh values (1,1), (2,2), (3,3) + query II rowsort WITH cte_1 AS (select count( cast(87.53 as INTEGER)) as c0, avg( cast(abs( cast(50.40 as INTEGER)) as INTEGER)) as c1, subq_0.c0 as c2 from (select distinct ref_5.c_f as c0, 75 as c1, ref_5.c_f as c2 from t_qh as ref_5 where ref_5.c_f is not NULL) as subq_0 group by subq_0.c0) select distinct cast(sum( cast((case when (ref_23.c0 > ref_23.c0) and (ref_23.c0 < ref_23.c1) then ref_23.c1 else ref_23.c1 end & ref_23.c1) as INTEGER)) as bigint) as c3, ref_23.c0 as c4 from cte_1 as ref_23 group by ref_23.c0 ---- +150 +1 + +query II rowsort +WITH cte_1 AS (select count( cast(87.53 as INTEGER)) as c0, avg( cast(abs( cast(50.40 as INTEGER)) as INTEGER)) as c1, subq_0.c0 as c2 from +(select distinct ref_5.c_f as c0, 75 as c1, ref_5.c_f as c2 from t_qh as ref_5 where ref_5.c_f is not NULL) as subq_0 group by subq_0.c0) +select distinct cast(sum( cast((case when (ref_23.c0 > ref_23.c0) and (ref_23.c0 < ref_23.c1) then ref_23.c1 else ref_23.c1 end) as INTEGER)) as bigint) +as c3, ref_23.c0 as c4 from cte_1 as ref_23 group by ref_23.c0 +---- +150 +1 statement ok rollback diff --git a/sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test b/sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test --- a/sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test +++ b/sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test @@ -4,6 +4,9 @@ start transaction statement ok create table t_qh ( c_f INTEGER , c_y2 INTEGER , c_i768 INTEGER , c_tqx TEXT , primary key(c_f, c_y2), unique(c_y2) ) +statement ok rowcount 3 +insert into t_qh values (1,1,1,'a'), (2,2,2,'b'), (3,3,3,'c') + query I rowsort select ref_1.c_i768 as c0 from t_qh as ref_1 cross join (select ref_2.c_i768 as c0 from t_qh as ref_2 inner join t_qh as ref_3 on (1=1) where ref_3.c_f <> ref_3.c_y2) as subq_0 where ref_1.c_y2 < ( select ref_1.c_f as c0 from t_qh as ref_4 diff --git a/sql/test/BugTracker-2021/Tests/unnest-union.Bug-7127.test b/sql/test/BugTracker-2021/Tests/unnest-union.Bug-7127.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2021/Tests/unnest-union.Bug-7127.test @@ -0,0 +1,45 @@ +statement ok +start transaction + +statement ok +create table t_qh ( c_f INTEGER , c_y2 INTEGER , c_i768 INTEGER , c_tqx TEXT , c_mknkhml TEXT , primary key(c_f, c_y2), unique(c_y2) ) + +statement ok rowcount 3 +insert into t_qh values (1,1,1,'a','a'), (2,2,2,'b','b'), (3,3,3,'c','c') + +statement ok +create table t_ckfystsc ( c_kvhq5p INTEGER , c_aifpl INTEGER , c_jf6 TEXT , c_f31ix TEXT NOT NULL, c_lk0zqfa INTEGER , c_qotzuxn INTEGER , c_w_z TEXT , primary key(c_lk0zqfa), unique(c_kvhq5p) ) + +statement ok rowcount 3 +insert into t_ckfystsc values (1,1,'a','a',1,1,'a'), (2,2,'b','b',2,2,'b'), (3,3,'c','c',3,3,'c') + +statement ok +create table t_irwrntam7 as select ref_0.c_i768 as c0, ref_0.c_i768 as c1, ref_0.c_f as c2, ref_0.c_i768 as c3 from t_qh as ref_0 where +(ref_0.c_f in ( select ref_1.c_lk0zqfa as c0 from t_ckfystsc as ref_1)) and (ref_0.c_y2 >= ( select ref_0.c_y2 as c0 from t_qh as ref_7 union select ref_0.c_f as c0 from t_qh as ref_9)) + +query IIII rowsort +select ref_0.c_i768 as c0, ref_0.c_i768 as c1, ref_0.c_f as c2, ref_0.c_i768 as c3 from t_qh as ref_0 where +(ref_0.c_f in ( select ref_1.c_lk0zqfa as c0 from t_ckfystsc as ref_1)) and (ref_0.c_y2 >= ( select ref_0.c_y2 as c0 from t_qh as ref_7 union select ref_0.c_f as c0 from t_qh as ref_9)) +---- +1 +1 +1 +1 +2 +2 +2 +2 +3 +3 +3 +3 + +query I rowsort +select 1 from t_qh where c_f in (select 2 from t_ckfystsc) and c_y2 = (select c_y2 union select c_f) +---- +1 + +statement ok +rollback + + _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list