Changeset: c88cced81977 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c88cced81977
Added Files:
        sql/test/BugTracker-2024/Tests/7571-crash-orderby.test
Modified Files:
        sql/backends/monet5/rel_bin.c
        sql/test/BugTracker-2024/Tests/All
Branch: Aug2024
Log Message:

Don't swap if there is no right. Fix #7571.


diffs (30 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -1804,7 +1804,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
                                s = NULL;
                                if (!swapped)
                                        s = exp_bin(be, n->data, left, NULL, 
grp, ext, cnt, NULL, depth+1, 0, push);
-                               if (!s && (first || swapped)) {
+                               if (!s && right && (first || swapped)) {
                                        clean_mal_statements(be, oldstop, 
oldvtop);
                                        s = exp_bin(be, n->data, right, NULL, 
grp, ext, cnt, NULL, depth+1, 0, push);
                                        swapped = 1;
diff --git a/sql/test/BugTracker-2024/Tests/7571-crash-orderby.test 
b/sql/test/BugTracker-2024/Tests/7571-crash-orderby.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/7571-crash-orderby.test
@@ -0,0 +1,5 @@
+statement ok
+CREATE TABLE  t1(c0 BOOLEAN, c2 VARCHAR(500))
+
+statement ok
+SELECT t1.c2, t1.c0 FROM t1  ORDER BY ((IFNULL('', t1.c0) IS NOT DISTINCT FROM 
LEFT('1', t1.c0)) LIKE ('1e500' >> 2)) ASC
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
@@ -85,3 +85,4 @@ 7465-fwf-block-boundary-error
 7566-connections-refused
 7562-interval-overflow
 7569-temp-table-column-reuse
+7571-crash-orderby
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to