Changeset: 7a95a118e182 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7a95a118e182
Added Files:
        sql/test/SQLancer/Tests/sqlancer03.sql
        sql/test/SQLancer/Tests/sqlancer03.stable.err
        sql/test/SQLancer/Tests/sqlancer03.stable.out
Modified Files:
        monetdb5/modules/atoms/str.c
        sql/storage/store.c
        sql/test/SQLancer/Tests/All
Branch: default
Log Message:

Merged with Jun2020


diffs (105 lines):

diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -3565,7 +3565,7 @@ STRsplitpart(str *res, str *haystack, st
 {
        size_t len;
        int f = *field;
-       char *p;
+       char *p = NULL;
        const char *s = *haystack;
        const char *s2 = *needle;
 
@@ -3581,10 +3581,11 @@ STRsplitpart(str *res, str *haystack, st
        }
 
        len = strlen(s2);
-
-       while ((p = strstr(s, s2)) != NULL && f > 1) {
-               s = p + len;
-               f--;
+       if (len) {
+               while ((p = strstr(s, s2)) != NULL && f > 1) {
+                       s = p + len;
+                       f--;
+               }
        }
 
        if (f != 1) {
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -3511,9 +3511,8 @@ table_dup(sql_trans *tr, int flags, sql_
        /* Needs copy when committing (ie from tr to gtrans) and
         * on savepoints from tr->parent to new tr */
        if (flags) {
+               assert(t->data == NULL);
                t->base.allocated = ot->base.allocated;
-               if (ot->data)
-                       (void)store_funcs.destroy_del(tr, ot);
                t->data = ot->data;
                ot->base.allocated = 0;
                ot->data = NULL;
@@ -3783,7 +3782,8 @@ trans_init(sql_trans *tr, backend_stack 
                                t->base.rtime = t->base.wtime = 0;
                                t->base.stime = pt->base.wtime;
                                if (!istmp && !t->base.allocated) {
-                                       (void)store_funcs.destroy_del(tr, t);
+                                       if (t->data)
+                                               
(void)store_funcs.destroy_del(tr, t);
                                        t->data = NULL;
                                }
                                assert (istmp || !t->base.allocated);
diff --git a/sql/test/SQLancer/Tests/All b/sql/test/SQLancer/Tests/All
--- a/sql/test/SQLancer/Tests/All
+++ b/sql/test/SQLancer/Tests/All
@@ -1,2 +1,3 @@
 sqlancer01
 sqlancer02
+sqlancer03
diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql 
b/sql/test/SQLancer/Tests/sqlancer03.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/SQLancer/Tests/sqlancer03.sql
@@ -0,0 +1,1 @@
+select splitpart(r'%Fz晟2墁', '', 1), splitpart(r'%Fz晟2墁', r'', 2), 
splitpart(r'%Fz晟2墁', r'', 1271186887);
diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.err 
b/sql/test/SQLancer/Tests/sqlancer03.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/SQLancer/Tests/sqlancer03.stable.err
@@ -0,0 +1,12 @@
+stderr of test 'sqlancer03` in directory 'sql/test/SQLancer` itself:
+
+
+# 17:14:16 >  
+# 17:14:16 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-439482" "--port=37916"
+# 17:14:16 >  
+
+
+# 17:14:16 >  
+# 17:14:16 >  "Done."
+# 17:14:16 >  
+
diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.out 
b/sql/test/SQLancer/Tests/sqlancer03.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/SQLancer/Tests/sqlancer03.stable.out
@@ -0,0 +1,18 @@
+stdout of test 'sqlancer03` in directory 'sql/test/SQLancer` itself:
+
+
+# 17:14:16 >  
+# 17:14:16 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-439482" "--port=37916"
+# 17:14:16 >  
+
+#select splitpart(r'%Fz晟2墁', '', 1), splitpart(r'%Fz晟2墁', r'', 2), 
splitpart(r'%Fz晟2墁', r'', 1271186887);
+% .%2, .%3,    .%4 # table_name
+% %2,  %3,     %4 # name
+% clob,        clob,   varchar # type
+% 9,   0,      0 # length
+[ "%Fz晟2墁",   "",     ""      ]
+
+# 17:14:16 >  
+# 17:14:16 >  "Done."
+# 17:14:16 >  
+
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to