Changeset: 99781d3ba466 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=99781d3ba466
Added Files:
        sql/test/BugTracker-2017/Tests/createorreplace-system-func.Bug-6499.sql
        
sql/test/BugTracker-2017/Tests/createorreplace-system-func.Bug-6499.stable.err
        
sql/test/BugTracker-2017/Tests/createorreplace-system-func.Bug-6499.stable.out
        sql/test/BugTracker-2017/Tests/select-in-returns-null.Bug-6491.sql
        
sql/test/BugTracker-2017/Tests/select-in-returns-null.Bug-6491.stable.err
        
sql/test/BugTracker-2017/Tests/select-in-returns-null.Bug-6491.stable.out
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-algebra-operators.Bug-6494.stable.err
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-algebra-operators.Bug-6494.stable.out
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.err
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.out
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-hidden-alias.Bug-6495.stable.err
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-hidden-alias.Bug-6495.stable.out
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-min-distinct-empty-table.Bug-6493.stable.err
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-min-distinct-empty-table.Bug-6493.stable.out
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-not-between.Bug-6497.stable.err
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-not-between.Bug-6497.stable.out
        sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.sql
        sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.stable.err
        sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.stable.out
Modified Files:
        gdk/gdk_search.c
        sql/backends/monet5/sql_scenario.c
        sql/backends/monet5/sql_statement.c
        sql/common/sql_types.c
        sql/jdbc/tests/Tests/Test_Rtimedate.stable.out
        sql/server/rel_optimizer.c
        sql/server/rel_psm.c
        sql/server/rel_select.c
        sql/server/sql_atom.c
        sql/server/sql_parser.y
        sql/server/sql_qc.c
        sql/server/sql_qc.h
        sql/server/sql_semantic.h
        
sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.stable.out
        
sql/test/BugTracker-2009/Tests/segfault_when_quitting_debugger.SF-2538837.stable.out
        sql/test/BugTracker-2012/Tests/null_except_null.Bug-3040.stable.out
        
sql/test/BugTracker-2014/Tests/hexadecimal_literals.Bug-3621.stable.err.int128
        sql/test/BugTracker-2014/Tests/hexadecimal_literals.Bug-3621.stable.out
        
sql/test/BugTracker-2014/Tests/hexadecimal_literals.Bug-3621.stable.out.int128
        sql/test/BugTracker-2014/Tests/manifold.Bug-3556.stable.out
        
sql/test/BugTracker-2015/Tests/crash_in_reduce_groupby.Bug-3818.stable.out.int128
        sql/test/BugTracker-2016/Tests/select-in-from.Bug-6121.stable.out
        sql/test/BugTracker-2017/Tests/All
        
sql/test/BugTracker-2017/Tests/distinct_minus_count_distinct.Bug-6296.stable.out
        sql/test/BugTracker-2017/Tests/limit.Bug-6322.stable.out
        sql/test/BugTracker-2017/Tests/spurious_error.Bug-6344.stable.out
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.sql
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.out
        sql/test/BugTracker-2017/Tests/sqllitelogistest_case.Bug-6335.stable.err
        sql/test/BugTracker-2017/Tests/sqllitelogistest_case.Bug-6335.stable.out
        
sql/test/BugTracker-2017/Tests/type-resolution-error.Bugs-6313.stable.err
        
sql/test/bugs/Tests/subselect_multiple_unionall_where_1=1-bug-sf-1005596.stable.out
        sql/test/bugs/Tests/union_all-bug-sf-941788.stable.out
        sql/test/mapi/Tests/sql_int128.stable.out.int128
        sql/test/mergetables/Tests/sqlsmith.Bug-6480.stable.err
        sql/test/remote/Tests/partition_elim.stable.out
Branch: compressedcandidates
Log Message:

Merge with default


diffs (truncated from 2202 to 300 lines):

diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c
--- a/gdk/gdk_search.c
+++ b/gdk/gdk_search.c
@@ -458,8 +458,6 @@ SORTfndlast(BAT *b, const void *v)
        }
        if (b->ttype == TYPE_void) {
                assert(is_oid_nil(b->tseqbase));
-               if (is_oid_nil(*(const oid *) v))
-                       return 0;
                return BATcount(b);
        }
        return binsearch(NULL, 0, b->ttype, Tloc(b, 0),
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1157,6 +1157,7 @@ SQLparser(Client c)
        } else if (caching(m) && cachable(m, NULL) && m->emode != m_prepare && 
(be->q = qc_match(m->qc, m->sym, m->args, m->argc, m->scanner.key ^ 
m->session->schema->base.id)) != NULL) {
                /* query template was found in the query cache */
                scanner_query_processed(&(m->scanner));
+               m->no_mitosis = be->q->no_mitosis;
        } else {
                sql_rel *r;
 
@@ -1213,7 +1214,8 @@ SQLparser(Client c)
                                                  m->args,      /* the argument 
list */
                                                  m->argc, m->scanner.key ^ 
m->session->schema->base.id,        /* the statement hash key */
                                                  m->emode == m_prepare ? 
Q_PREPARE : m->type,  /* the type of the statement */
-                                                 escaped_q);
+                                                 escaped_q,
+                                                 m->no_mitosis);
                        }
                        if(!be->q) {
                                err = 1;
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -1574,7 +1574,7 @@ select2_join2(backend *be, stmt *op1, st
                q = pushBit(mb, q, TRUE);
                q = pushBit(mb, q, TRUE);
                q = pushBit(mb, q, TRUE);
-               q = pushBit(mb, q, FALSE);
+               q = pushBit(mb, q, (anti)?TRUE:FALSE);
                if (q == NULL)
                        return NULL;
        } else {
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -350,8 +350,9 @@ subtype_cmp(sql_subtype *t1, sql_subtype
 {
        if (!t1->type || !t2->type)
                return -1;
+
        if ( !(t1->type->eclass == t2->type->eclass && 
-              EC_INTERVAL(t1->type->eclass)) &&
+             (EC_INTERVAL(t1->type->eclass) || t1->type->eclass == EC_NUM)) &&
              (t1->digits != t2->digits || 
              (!(t1->type->eclass == t2->type->eclass && 
               t1->type->eclass == EC_FLT) &&
diff --git a/sql/jdbc/tests/Tests/Test_Rtimedate.stable.out 
b/sql/jdbc/tests/Tests/Test_Rtimedate.stable.out
--- a/sql/jdbc/tests/Tests/Test_Rtimedate.stable.out
+++ b/sql/jdbc/tests/Tests/Test_Rtimedate.stable.out
@@ -24,31 +24,71 @@ Ready.
 # 21:26:11 >  
 
 false  false
-1. 1, 2004-04-24 11:43:53.000000, 2004-04-24 11:43:53.0
-2. 1, 2004-04-24 11:43:53.000000, 11:43:53
-3. 1, 2004-04-24 11:43:53.000000, 2004-04-24
-4. 2, 11:43:53, 1970-01-01 11:43:53.0
-5. 2, 11:43:53, 11:43:53
-6. 2, 11:43:53, 1970-01-01
-7. 3, 2004-04-24, 2004-04-24 00:00:00.0
-8. 3, 2004-04-24, 00:00:00
-9. 3, 2004-04-24, 2004-04-24
-1. 4, 2004-04-24 11:43:53.000000, 2004-04-24 11:43:53.0
-2. 4, 2004-04-24 11:43:53.000000, 00:00:00
-warning: java.sql.SQLWarning: parsing failed, found: '-' in: "2004-04-24 
11:43:53.000000" at pos: 4
-3. 4, 2004-04-24 11:43:53.000000, 2004-04-24
-4. 5, 11:43:53, 1970-01-01 00:00:00.0
-warning: java.sql.SQLWarning: parsing failed, found: ':' in: "11:43:53" at 
pos: 2
-5. 5, 11:43:53, 11:43:53
-6. 5, 11:43:53, 1970-01-01
-warning: java.sql.SQLWarning: parsing failed, found: ':' in: "11:43:53" at 
pos: 2
-7. 6, 2004-04-24, 1970-01-01 00:00:00.0
-warning: java.sql.SQLWarning: parsing failed, expected more data after 
'2004-04-24'
-8. 6, 2004-04-24, 00:00:00
-warning: java.sql.SQLWarning: parsing failed, found: '-' in: "2004-04-24" at 
pos: 4
-9. 6, 2004-04-24, 2004-04-24
+1. ts 2004-04-24 11:43:53.123000 to ts: 2004-04-24 11:43:53.123
+1. ts 2004-04-24 11:43:53.123000 to tm: 11:43:53
+1. ts 2004-04-24 11:43:53.123000 to dt: 2004-04-24
+2. t 11:43:53 to ts: 1970-01-01 11:43:53.0
+2. t 11:43:53 to tm: 11:43:53
+2. t 11:43:53 to dt: 1970-01-01
+3. d 2004-04-24 to ts: 2004-04-24 00:00:00.0
+3. d 2004-04-24 to tm: 00:00:00
+3. d 2004-04-24 to dt: 2004-04-24
+4. vc 2004-04-24 11:43:53.654321 to ts: 2004-04-24 11:43:53.654321
+rs.getTime(colnm) failed with error: parsing failed, found: '-' in: 
"2004-04-24 11:43:53.654321" at pos: 5
+4. vc 2004-04-24 11:43:53.654321 to dt: 2004-04-24
+rs.getTimestamp(colnm) failed with error: parsing failed, found: ':' in: 
"11:43:53" at pos: 3
+5. vc 11:43:53 to tm: 11:43:53
+rs.getDate(colnm) failed with error: parsing failed, found: ':' in: "11:43:53" 
at pos: 3
+6. vc 2004-04-24 to ts: 2004-04-24 00:00:00.0
+rs.getTime(colnm) failed with error: parsing failed, found: '-' in: 
"2004-04-24" at pos: 5
+6. vc 2004-04-24 to dt: 2004-04-24
+11. ts 904-04-24 11:43:53.567000 to ts: 0904-04-24 11:43:53.567
+11. ts 904-04-24 11:43:53.567000 to tm: 11:43:53
+11. ts 904-04-24 11:43:53.567000 to dt: 0904-04-24
+12. ts 74-04-24 11:43:53.567000 to ts: 0074-04-24 11:43:53.567
+12. ts 74-04-24 11:43:53.567000 to tm: 11:43:53
+12. ts 74-04-24 11:43:53.567000 to dt: 0074-04-24
+13. ts 4-04-24 11:43:53.567000 to ts: 0004-04-24 11:43:53.567
+13. ts 4-04-24 11:43:53.567000 to tm: 11:43:53
+13. ts 4-04-24 11:43:53.567000 to dt: 0004-04-24
+14. d 904-04-24 to ts: 0904-04-24 00:00:00.0
+14. d 904-04-24 to tm: 00:00:00
+14. d 904-04-24 to dt: 0904-04-24
+15. d 74-04-24 to ts: 0074-04-24 00:00:00.0
+15. d 74-04-24 to tm: 00:00:00
+15. d 74-04-24 to dt: 0074-04-24
+16. d 4-04-24 to ts: 0004-04-24 00:00:00.0
+16. d 4-04-24 to tm: 00:00:00
+16. d 4-04-24 to dt: 0004-04-24
+17. vc 904-04-24 11:43:53.567 to ts: 0904-04-24 11:43:53.567
+rs.getTime(colnm) failed with error: parsing failed, found: '-' in: "904-04-24 
11:43:53.567" at pos: 4
+17. vc 904-04-24 11:43:53.567 to dt: 0904-04-24
+18. vc 74-04-24 11:43:53.567 to ts: 0074-04-24 11:43:53.567
+rs.getTime(colnm) failed with error: parsing failed, found: '-' in: "74-04-24 
11:43:53.567" at pos: 3
+18. vc 74-04-24 11:43:53.567 to dt: 0074-04-24
+19. vc 4-04-24 11:43:53.567 to ts: 0004-04-24 11:43:53.567
+rs.getTime(colnm) failed with error: parsing failed, found: '-' in: "4-04-24 
11:43:53.567" at pos: 2
+19. vc 4-04-24 11:43:53.567 to dt: 0004-04-24
+21. ts -4-04-24 11:43:53.567000 to ts: 0004-04-24 11:43:53.567
+21. ts -4-04-24 11:43:53.567000 to tm: 11:43:53
+21. ts -4-04-24 11:43:53.567000 to dt: 0004-04-24
+22. ts -2004-04-24 11:43:53.567000 to ts: 2004-04-24 11:43:53.567
+22. ts -2004-04-24 11:43:53.567000 to tm: 11:43:53
+22. ts -2004-04-24 11:43:53.567000 to dt: 2004-04-24
+23. d -4-04-24 to ts: 0004-04-24 00:00:00.0
+23. d -4-04-24 to tm: 00:00:00
+23. d -4-04-24 to dt: 0004-04-24
+24. d -3004-04-24 to ts: 3004-04-24 00:00:00.0
+24. d -3004-04-24 to tm: 00:00:00
+24. d -3004-04-24 to dt: 3004-04-24
+25. vc -2004-04-24 11:43:53.654321 to ts: 2004-04-24 11:43:53.654321
+rs.getTime(colnm) failed with error: parsing failed, found: '-' in: 
"-2004-04-24 11:43:53.654321" at pos: 6
+25. vc -2004-04-24 11:43:53.654321 to dt: 2004-04-24
+26. vc -3004-04-24 to ts: 3004-04-24 00:00:00.0
+rs.getTime(colnm) failed with error: parsing failed, found: '-' in: 
"-3004-04-24" at pos: 6
+26. vc -3004-04-24 to dt: 3004-04-24
 
-# 09:05:23 >  
-# 09:05:23 >  Done.
-# 09:05:23 >  
+# 16:59:26 >  
+# 16:59:26 >  "Done."
+# 16:59:26 >  
 
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
@@ -5063,6 +5063,9 @@ rel_reduce_groupby_exps(int *changes, mv
 
                                if (!exp_is_atom(e))
                                        append(ngbe, e);
+                               /* we need at least one gbe */
+                               else if (!n->next && list_empty(ngbe))
+                                       append(ngbe, e);
                                else
                                        append(dgbe, e);
                        }
@@ -5088,8 +5091,8 @@ rel_reduce_groupby_exps(int *changes, mv
                                        append(nexps, e);
                                }
                                rel->exps = nexps;
-                       }
-                       (*changes)++;
+                               (*changes)++;
+                       }
                }
        }
        return rel;
diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c
--- a/sql/server/rel_psm.c
+++ b/sql/server/rel_psm.c
@@ -810,6 +810,9 @@ rel_create_func(mvc *sql, dlist *qname, 
                        }
                        if (mvc_check_dependency(sql, func->base.id, 
!IS_PROC(func) ? FUNC_DEPENDENCY : PROC_DEPENDENCY, NULL))
                                return sql_error(sql, 02, SQLSTATE(42000) 
"CREATE OR REPLACE %s%s: there are database objects dependent on %s%s %s;", KF, 
F, kf, fn, func->base.name);
+                       if (!func->s) {
+                               return sql_error(sql, 02, SQLSTATE(42000) 
"CREATE OR REPLACE %s%s: not allowed to replace system %s%s %s;", KF, F, kf, 
fn, func->base.name);
+                       }
 
                        mvc_drop_func(sql, s, func, action);
                        sf = NULL;
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -1450,7 +1450,7 @@ rel_convert_types(mvc *sql, sql_exp **L,
                sql_subtype *i = lt;
                sql_subtype *r = rt;
 
-               if (subtype_cmp(lt, rt) != 0 || lt->type->localtype==0 || 
rt->type->localtype==0) {
+               if (subtype_cmp(lt, rt) != 0 || (tpe == type_equal_no_any && 
(lt->type->localtype==0 || rt->type->localtype==0))) {
                        sql_subtype super;
 
                        supertype(&super, r, i);
@@ -2139,7 +2139,7 @@ rel_logical_value_exp(mvc *sql, sql_rel 
                                        if (l)
                                                st = exp_subtype(l);
                                }
-                               if (l && !r && !n->next) { /* possibly a (not) 
in function call */
+                               if (l && !r) { /* possibly a (not) in function 
call */
                                        /* reset error */
                                        sql->session->status = 0;
                                        sql->errstr[0] = 0;
@@ -2147,23 +2147,17 @@ rel_logical_value_exp(mvc *sql, sql_rel 
                                        z = left;
                                        r = rel_value_exp(sql, &z, sval, f, 
ek); 
                                        if (z == left && r) {
-                                               sql_subfunc *f = NULL;
-
-                                               l = rel_check_type(sql, 
exp_subtype(r), l, type_equal);
-                                               if (!l) 
-                                                       return NULL;
-                                               f = sql_bind_func(sql->sa, 
sql->session->schema, "=", exp_subtype(l), exp_subtype(r), F_FUNC);
-                                               if (f)
-                                                       l = exp_binop(sql->sa, 
l, r, f);
-                                               if (f && l && sc->token == 
SQL_NOT_IN) {
-                                                       f = 
sql_bind_func(sql->sa, sql->session->schema, "not", exp_subtype(l), NULL, 
F_FUNC);
-                                                       return 
exp_unop(sql->sa, l, f);
-                                               } else if (f && l && sc->token 
== SQL_IN) {
-                                                       return l;
+                                               if (l && r && 
IS_ANY(st->type->eclass)){
+                                                       l = rel_check_type(sql, 
exp_subtype(r), l, type_equal);
+                                                       if (l)
+                                                               st = 
exp_subtype(l);
+                                                       else
+                                                               return NULL;
                                                }
-
-                                       }       
-                                       r = NULL;
+                                               z = NULL;
+                                       } else {
+                                               r = NULL;
+                                       }
                                }
                                if (!l || !r || !(r=rel_check_type(sql, st, r, 
type_equal))) {
                                        rel_destroy(right);
@@ -2227,7 +2221,11 @@ rel_logical_value_exp(mvc *sql, sql_rel 
                                reset_processed(left);
                        } else
                                *rel = left;
-                       if (sc->token == SQL_NOT_IN)
+                       if (f == sql_sel) {
+                               e = rel_unop_(sql, r, NULL, "isnull", 
card_value);
+                               if (sc->token == SQL_IN)
+                                       e = rel_unop_(sql, e, NULL, "not", 
card_value);
+                       } else if (sc->token == SQL_NOT_IN)
                                e = rel_binop_(sql, l, r, NULL, "<>", 
card_value);
                        else
                                e = rel_binop_(sql, l, r, NULL, "=", 
card_value);
@@ -2601,7 +2599,7 @@ rel_logical_exp(mvc *sql, sql_rel *rel, 
                                        sql_exp *e;
 
                                        l = ll->h->data;
-                                       if (rel_convert_types(sql, &l, &r, 1, 
type_equal) < 0) 
+                                       if (rel_convert_types(sql, &l, &r, 1, 
type_equal_no_any) < 0) 
                                                return NULL;
                                        e = exp_compare(sql->sa, l, r, 
cmp_equal );
                                        if (!e)
diff --git a/sql/server/sql_atom.c b/sql/server/sql_atom.c
--- a/sql/server/sql_atom.c
+++ b/sql/server/sql_atom.c
@@ -1199,6 +1199,13 @@ atom_add(atom *a1, atom *a2)
        if ((!EC_COMPUTE(a1->tpe.type->eclass) && (a1->tpe.type->eclass != 
EC_DEC || a1->tpe.digits != a2->tpe.digits || a1->tpe.scale != a2->tpe.scale)) 
|| a1->tpe.digits < a2->tpe.digits || a1->tpe.type->localtype != 
a2->tpe.type->localtype) {
                return NULL;
        }
+       if (a1->tpe.type->localtype < a2->tpe.type->localtype ||
+           (a1->tpe.type->localtype == a2->tpe.type->localtype &&
+            a1->tpe.digits < a2->tpe.digits)) {
+               atom *t = a1;
+               a1 = a2;
+               a2 = t;
+       }
        dst.vtype = a1->tpe.type->localtype;
        if (VARcalcadd(&dst, &a1->data, &a2->data, 1) != GDK_SUCCEED)
                return NULL;
@@ -1216,9 +1223,18 @@ atom_sub(atom *a1, atom *a2)
        if ((!EC_COMPUTE(a1->tpe.type->eclass) && (a1->tpe.type->eclass != 
EC_DEC || a1->tpe.digits != a2->tpe.digits || a1->tpe.scale != a2->tpe.scale)) 
|| a1->tpe.digits < a2->tpe.digits || a1->tpe.type->localtype != 
a2->tpe.type->localtype) {
                return NULL;
        }
-       dst.vtype = a1->tpe.type->localtype;
+       if (a1->tpe.type->localtype < a2->tpe.type->localtype ||
+           (a1->tpe.type->localtype == a2->tpe.type->localtype &&
+            a1->tpe.digits < a2->tpe.digits))
+               dst.vtype = a2->tpe.type->localtype;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to