Changeset: b42cd851c71a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b42cd851c71a
Modified Files:
sql/server/rel_optimizer.c
sql/test/mergetables/Tests/sqlsmith-exists.stable.out
Branch: default
Log Message:
fixed crash in order_joins, in case of complex multi relation join (or select)
expressions
diffs (58 lines):
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
@@ -936,6 +936,11 @@ order_joins(mvc *sql, list *rels, list *
l = rn->data;
r = find_rel(rels, cje->l);
}
+ if (!r) {
+ fnd = 1; // not really, but this bails
out
+ continue;
+ }
+
list_remove_data(rels, r);
append(n_rels, 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
@@ -131,6 +131,39 @@ stdout of test 'sqlsmith-exists` in dire
% 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
+#CREATE TABLE integers(i INTEGER);
+#INSERT INTO integers VALUES (1), (2), (3), (NULL);
+[ 4 ]
+#CREATE TABLE tbl_ProductSales (ColID int, Product_Category varchar(64),
Product_Name varchar(64), TotalSales int);
+#INSERT INTO tbl_ProductSales VALUES (1,'Game','Mobo Game',200),(2,'Game','PKO
Game',400),(3,'Fashion','Shirt',500),(4,'Fashion','Shorts',100);
+[ 4 ]
+#create table analytics (aa int, bb int, cc bigint);
+#insert into analytics values (15, 3, 15), (3, 1, 3), (2, 1, 2), (5, 3, 5),
(NULL, 2, NULL), (3, 2, 3), (4, 1, 4), (6, 3, 6), (8, 2, 8), (NULL, 4, NULL);
+[ 10 ]
+#SELECT subq_1.c3 AS c0
+#FROM
+# (SELECT 1 AS c0,
+# subq_0.c8 AS c1,
+# subq_0.c6 AS c2,
+# subq_0.c0 AS c3,
+# subq_0.c4 AS c4,
+# subq_0.c9 AS c5,
+# subq_0.c6 AS c6,
+# subq_0.c0 AS c7,
+# subq_0.c3 AS c8,
+# subq_0.c4 AS c9,
+# CASE
+# WHEN (94 IS NOT NULL)
+# OR (subq_0.c0 IS NULL) THEN subq_0.c4
+# ELSE subq_0.c4
+# END AS c10,
+# subq_0.c5 AS c11,
+# subq_0.c4 AS c12
+# FROM
+% sys.subq_0 # table_name
+% c0 # name
+% int # type
+% 1 # length
#ROLLBACK;
# 19:56:32 >
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list