Changeset: 423721732582 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/423721732582
Modified Files:
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql_cat.c
        sql/backends/monet5/sql_statement.c
        sql/backends/monet5/sql_upgrades.c
        sql/common/sql_types.c
        sql/common/sql_types.h
        sql/include/sql_catalog.h
        sql/scripts/40_json.sql
        sql/server/rel_dump.c
        sql/server/rel_exp.c
        sql/server/rel_exp.h
        sql/server/rel_optimize_exps.c
        sql/server/rel_optimize_others.c
        sql/server/rel_optimize_proj.c
        sql/server/rel_optimize_sel.c
        sql/server/rel_propagate.c
        sql/server/rel_psm.c
        sql/server/rel_rel.c
        sql/server/rel_rewriter.c
        sql/server/rel_select.c
        sql/server/rel_select.h
        sql/server/rel_sequence.c
        sql/server/rel_unnest.c
        sql/server/rel_updates.c
        sql/server/rel_xml.c
        sql/server/sql_parser.y
        sql/server/sql_privileges.c
        sql/server/sql_semantic.c
        sql/server/sql_semantic.h
        sql/storage/objectset.c
        
sql/test/BugDay_2005-10-06_2.9.3/Tests/CrashMe_SQL_server_crash-2.SF-921673.test
        
sql/test/BugDay_2005-10-06_2.9.3/Tests/alter_table_describe.SF-1146092.test
        sql/test/BugDay_2005-10-06_2.9.3/Tests/not_null.SF-933194.test
        sql/test/BugDay_2005-10-06_2.9.3/Tests/type_dump_test.SF-989257.test
        sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.test
        sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.test
        sql/test/BugTracker-2012/Tests/interval_timestamp.Bug-3002.test
        
sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py
        sql/test/BugTracker-2014/Tests/ifthenelse.Bug-3546.test
        sql/test/BugTracker-2015/Tests/crash_in_reduce_groupby.Bug-3818.test
        sql/test/BugTracker-2015/Tests/large_join.Bug-3809.test
        sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.test
        
sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.test
        sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test
        sql/test/BugTracker-2017/Tests/caching_stats_bug.6374.test
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-aggregation-having-avg.Bug-6428.test
        sql/test/BugTracker-2018/Tests/comment-on-table-is-null.Bug-6639.test
        
sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.test
        sql/test/BugTracker-2019/Tests/outer-join-varchar.Bug-6776.test
        sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
        sql/test/BugTracker-2023/Tests/greatest-least-multi-arg-7391.test
        sql/test/BugTracker-2023/Tests/join-on-row_number-over-7403.test
        sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
        sql/test/BugTracker/Tests/multi-column-constraint.SF-1964587.test
        sql/test/SQLancer/Tests/sqlancer04.test
        sql/test/SQLancer/Tests/sqlancer08.test
        sql/test/SQLancer/Tests/sqlancer09.test
        sql/test/SQLancer/Tests/sqlancer17.test
        sql/test/Tests/keys.test
        sql/test/Tests/mediumint.test
        sql/test/Tests/select_window_pushdown.test
        sql/test/analytics/Tests/analytics00.test
        sql/test/bugs/Tests/rtrim_bug.test
        sql/test/emptydb/Tests/check.stable.out.int128
        sql/test/merge-partitions/Tests/mergepart31.test
        sql/test/mergetables/Tests/part-elim.test
        sql/test/miscellaneous/Tests/groupby_error.test
        sql/test/miscellaneous/Tests/groupby_expressions.test
        sql/test/miscellaneous/Tests/groupby_prepare.stable.err
        sql/test/miscellaneous/Tests/groupby_prepare.stable.out
        sql/test/miscellaneous/Tests/prepare.test
        sql/test/miscellaneous/Tests/rel_push_count_down.test
        sql/test/miscellaneous/Tests/simple_plans.test
        sql/test/miscellaneous/Tests/simple_selects.test
        sql/test/miscellaneous/Tests/unique_keys.test
        sql/test/miscellaneous/Tests/values.test
        sql/test/miscellaneous/Tests/view-mul-digits.test
        sql/test/orderidx/Tests/imprints_hge_type.test
        sql/test/orderidx/Tests/oidx_hge_type.test
        sql/test/out2in/Tests/out2in.test
        sql/test/pg_regress/Tests/int8.stable.err.int128
        sql/test/pg_regress/Tests/int8.test
        sql/test/prepare/Tests/crash_with_prepare_statement.Bug-2549.stable.out
        sql/test/prepare/Tests/sample.15.stable.out
        sql/test/prepare/Tests/sqlancer_prepare.stable.out.int128
        sql/test/rel-optimizers/Tests/split-select.test
        sql/test/sys-schema/Tests/utilities.test
        sql/test/sys-schema/Tests/webExamplesComparisonFunctionsOperators.test
        sql/test/sys-schema/Tests/webExamplesMathematicalFunctionsOperators.test
Branch: cleanup_types
Log Message:

Major cleanup of sql types system.
All function/aggregate resolutions is done via a single code path
and auto-coercions are handled via
the check_arguments*


diffs (truncated from 10288 to 300 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
@@ -82,7 +82,7 @@ sql_unop_(backend *be, const char *fname
        sql_subfunc *f = NULL;
 
        rt = tail_type(rs);
-       f = sql_bind_func(sql, "sys", fname, rt, NULL, F_FUNC, true);
+       f = sql_bind_func(sql, "sys", fname, rt, NULL, F_FUNC, true, true);
        /* try to find the function without a type, and convert
         * the value to the type needed by this function!
         */
@@ -461,10 +461,10 @@ handle_in_exps(backend *be, sql_exp *ce,
        if (c->nrcols == 0 || depth || !reduce) {
                sql_subtype *bt = sql_bind_localtype("bit");
                sql_subfunc *cmp = (in)
-                       ?sql_bind_func(sql, "sys", "=", tail_type(c), 
tail_type(c), F_FUNC, true)
-                       :sql_bind_func(sql, "sys", "<>", tail_type(c), 
tail_type(c), F_FUNC, true);
-               sql_subfunc *a = (in)?sql_bind_func(sql, "sys", "or", bt, bt, 
F_FUNC, true)
-                                    :sql_bind_func(sql, "sys", "and", bt, bt, 
F_FUNC, true);
+                       ?sql_bind_func(sql, "sys", "=", tail_type(c), 
tail_type(c), F_FUNC, true, true)
+                       :sql_bind_func(sql, "sys", "<>", tail_type(c), 
tail_type(c), F_FUNC, true, true);
+               sql_subfunc *a = (in)?sql_bind_func(sql, "sys", "or", bt, bt, 
F_FUNC, true, true)
+                                    :sql_bind_func(sql, "sys", "and", bt, bt, 
F_FUNC, true, true);
 
                for (n = nl->h; n; n = n->next) {
                        sql_exp *e = n->data;
@@ -634,11 +634,11 @@ exp_bin_or(backend *be, sql_exp *e, stmt
                        return s;
 
                if (!reduce && sin) {
-                       sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"or":"and", bt, bt, F_FUNC, true);
+                       sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"or":"and", bt, bt, F_FUNC, true, true);
                        assert(f);
                        s = stmt_binop(be, sin, s, NULL, f);
                } else if (!sin && sel1 && sel1->nrcols == 0 && s->nrcols == 0) 
{
-                       sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"or":"and", bt, bt, F_FUNC, true);
+                       sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"or":"and", bt, bt, F_FUNC, true, true);
                        assert(f);
                        s = stmt_binop(be, sel1, s, sin, f);
                } else if (sel1 && (sel1->nrcols == 0 || s->nrcols == 0)) {
@@ -665,11 +665,11 @@ exp_bin_or(backend *be, sql_exp *e, stmt
                        return s;
 
                if (!reduce && sin) {
-                       sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"or":"and", bt, bt, F_FUNC, true);
+                       sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"or":"and", bt, bt, F_FUNC, true, true);
                        assert(f);
                        s = stmt_binop(be, sin, s, NULL, f);
                } else if (!sin && sel2 && sel2->nrcols == 0 && s->nrcols == 0) 
{
-                       sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"or":"and", bt, bt, F_FUNC, true);
+                       sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"or":"and", bt, bt, F_FUNC, true, true);
                        assert(f);
                        s = stmt_binop(be, sel2, s, sin, f);
                } else if (sel2 && (sel2->nrcols == 0 || s->nrcols == 0)) {
@@ -684,7 +684,7 @@ exp_bin_or(backend *be, sql_exp *e, stmt
                sel2 = s;
        }
        if (sel1->nrcols == 0 && sel2->nrcols == 0) {
-               sql_subfunc *f = sql_bind_func(be->mvc, "sys", anti?"and":"or", 
bt, bt, F_FUNC, true);
+               sql_subfunc *f = sql_bind_func(be->mvc, "sys", anti?"and":"or", 
bt, bt, F_FUNC, true, true);
                assert(f);
                return stmt_binop(be, sel1, sel2, NULL, f);
        }
@@ -709,7 +709,7 @@ exp_bin_or(backend *be, sql_exp *e, stmt
                }
        }
        if (!reduce) {
-                       sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"and":"or", bt, bt, F_FUNC, true);
+                       sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"and":"or", bt, bt, F_FUNC, true, true);
                        assert(f);
                        return stmt_binop(be, sel1, sel2, NULL, f);
        }
@@ -725,9 +725,9 @@ exp2bin_case(backend *be, sql_exp *fe, s
        int next_cond = 1, single_value = (fe->card <= CARD_ATOM && (!left || 
!left->nrcols));
        char name[16], *nme = NULL;
        sql_subtype *bt = sql_bind_localtype("bit");
-       sql_subfunc *not = sql_bind_func(be->mvc, "sys", "not", bt, NULL, 
F_FUNC, true);
-       sql_subfunc *or = sql_bind_func(be->mvc, "sys", "or", bt, bt, F_FUNC, 
true);
-       sql_subfunc *and = sql_bind_func(be->mvc, "sys", "and", bt, bt, F_FUNC, 
true);
+       sql_subfunc *not = sql_bind_func(be->mvc, "sys", "not", bt, NULL, 
F_FUNC, true, true);
+       sql_subfunc *or = sql_bind_func(be->mvc, "sys", "or", bt, bt, F_FUNC, 
true, true);
+       sql_subfunc *and = sql_bind_func(be->mvc, "sys", "and", bt, bt, F_FUNC, 
true, true);
 
        if (single_value) {
                /* var_x = nil; */
@@ -832,7 +832,7 @@ exp2bin_case(backend *be, sql_exp *fe, s
                                if (en->next) {
                                        cond = stmt_unop(be, cond, nsel, not);
 
-                                       sql_subfunc *isnull = 
sql_bind_func(be->mvc, "sys", "isnull", bt, NULL, F_FUNC, true);
+                                       sql_subfunc *isnull = 
sql_bind_func(be->mvc, "sys", "isnull", bt, NULL, F_FUNC, true, true);
                                        cond = stmt_binop(be, cond, 
stmt_unop(be, cond, nsel, isnull), nsel, or);
                                        if (ocond)
                                                cond = stmt_binop(be, ocond, 
cond, nsel, and);
@@ -894,9 +894,9 @@ exp2bin_casewhen(backend *be, sql_exp *f
        int next_cond = 1, single_value = (fe->card <= CARD_ATOM && (!left || 
!left->nrcols));
        char name[16], *nme = NULL;
        sql_subtype *bt = sql_bind_localtype("bit");
-       sql_subfunc *not = sql_bind_func(be->mvc, "sys", "not", bt, NULL, 
F_FUNC, true);
-       sql_subfunc *or = sql_bind_func(be->mvc, "sys", "or", bt, bt, F_FUNC, 
true);
-       sql_subfunc *and = sql_bind_func(be->mvc, "sys", "and", bt, bt, F_FUNC, 
true);
+       sql_subfunc *not = sql_bind_func(be->mvc, "sys", "not", bt, NULL, 
F_FUNC, true, true);
+       sql_subfunc *or = sql_bind_func(be->mvc, "sys", "or", bt, bt, F_FUNC, 
true, true);
+       sql_subfunc *and = sql_bind_func(be->mvc, "sys", "and", bt, bt, F_FUNC, 
true, true);
        sql_subfunc *cmp;
 
        if (single_value) {
@@ -913,7 +913,7 @@ exp2bin_casewhen(backend *be, sql_exp *f
        stmt *case_when = exp_bin(be, e, left, right, NULL, NULL, NULL, nsel, 
depth+1, 0, 1);
        if (!case_when)
                return NULL;
-       cmp = sql_bind_func(be->mvc, "sys", "=", exp_subtype(e), 
exp_subtype(e), F_FUNC, true);
+       cmp = sql_bind_func(be->mvc, "sys", "=", exp_subtype(e), 
exp_subtype(e), F_FUNC, true, true);
        if (!cmp)
                return NULL;
        if (!single_value && !case_when->nrcols) {
@@ -1047,7 +1047,7 @@ exp2bin_casewhen(backend *be, sql_exp *f
                                if (en->next) {
                                        cond = stmt_unop(be, cond, nsel, not);
 
-                                       sql_subfunc *isnull = 
sql_bind_func(be->mvc, "sys", "isnull", bt, NULL, F_FUNC, true);
+                                       sql_subfunc *isnull = 
sql_bind_func(be->mvc, "sys", "isnull", bt, NULL, F_FUNC, true, true);
                                        cond = stmt_binop(be, cond, 
stmt_unop(be, cond, nsel, isnull), nsel, or);
                                        if (ocond)
                                                cond = stmt_binop(be, ocond, 
cond, nsel, and);
@@ -1075,8 +1075,8 @@ exp2bin_coalesce(backend *be, sql_exp *f
        int single_value = (fe->card <= CARD_ATOM && (!left || !left->nrcols));
        char name[16], *nme = NULL;
        sql_subtype *bt = sql_bind_localtype("bit");
-       sql_subfunc *and = sql_bind_func(be->mvc, "sys", "and", bt, bt, F_FUNC, 
true);
-       sql_subfunc *not = sql_bind_func(be->mvc, "sys", "not", bt, NULL, 
F_FUNC, true);
+       sql_subfunc *and = sql_bind_func(be->mvc, "sys", "and", bt, bt, F_FUNC, 
true, true);
+       sql_subfunc *not = sql_bind_func(be->mvc, "sys", "not", bt, NULL, 
F_FUNC, true, true);
 
        if (single_value) {
                /* var_x = nil; */
@@ -1115,7 +1115,7 @@ exp2bin_coalesce(backend *be, sql_exp *f
                                stmt *pos = rsel;
 
                                if (en->next) {
-                                       sql_subfunc *a = sql_bind_func(be->mvc, 
"sys", "isnotnull", tail_type(es), NULL, F_FUNC, true);
+                                       sql_subfunc *a = sql_bind_func(be->mvc, 
"sys", "isnotnull", tail_type(es), NULL, F_FUNC, true, true);
                                        ncond = stmt_unop(be, es, NULL, a);
                                        if (ncond->nrcols == 0) {
                                                stmt *l = 
bin_find_smallest_column(be, left);
@@ -1155,7 +1155,7 @@ exp2bin_coalesce(backend *be, sql_exp *f
                } else {
                        stmt *cond = ocond;
                        if (en->next) {
-                               sql_subfunc *a = sql_bind_func(be->mvc, "sys", 
"isnotnull", tail_type(es), NULL, F_FUNC, true);
+                               sql_subfunc *a = sql_bind_func(be->mvc, "sys", 
"isnotnull", tail_type(es), NULL, F_FUNC, true, true);
                                ncond = stmt_unop(be, es, nsel, a);
 
                                if (ocond)
@@ -1825,7 +1825,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
                                /* value compare or select */
                                if (!reduce || (l->nrcols == 0 && r->nrcols == 
0)) {
                                        sql_subfunc *f = sql_bind_func(sql, 
"sys", compare_func((comp_type)e->flag, is_anti(e)),
-                                                                               
                   tail_type(l), tail_type(l), F_FUNC, true);
+                                                                               
                   tail_type(l), tail_type(l), F_FUNC, true, true);
                                        assert(f);
                                        if (is_semantics(e)) {
                                                if (exp_is_null(e->l) && 
exp_is_null(e->r)) {
@@ -1980,7 +1980,7 @@ sql_Nop_(backend *be, const char *fname,
                list_append(tl, tail_type(a4));
        }
 
-       if ((f = sql_bind_func_(sql, "sys", fname, tl, F_FUNC, true)))
+       if ((f = sql_bind_func_(sql, "sys", fname, tl, F_FUNC, true, true)))
                return stmt_Nop(be, stmt_list(be, sl), NULL, f, NULL);
        return sql_error(sql, ERR_NOTFOUND, SQLSTATE(42000) "SELECT: no such 
operator '%s'", fname);
 }
@@ -3005,7 +3005,7 @@ rel2bin_groupjoin(backend *be, sql_rel *
                                        m = sql_Nop_(be, "ifthenelse", 
sql_unop_(be, "isnull", m), stmt_bool(be, false), m, NULL);
                                if (!exist) {
                                        sql_subtype *bt = 
sql_bind_localtype("bit");
-                                       sql_subfunc *not = 
sql_bind_func(be->mvc, "sys", "not", bt, NULL, F_FUNC, true);
+                                       sql_subfunc *not = 
sql_bind_func(be->mvc, "sys", "not", bt, NULL, F_FUNC, true, true);
                                        m = stmt_unop(be, m, NULL, not);
                                }
                        }
@@ -3284,12 +3284,12 @@ rel2bin_join(backend *be, sql_rel *rel, 
                stmt *last = l->t->data;
                sql_subtype *tp = tail_type(last);
 
-               sql_subfunc *isnil = sql_bind_func(sql, "sys", "isnull", tp, 
NULL, F_FUNC, true);
+               sql_subfunc *isnil = sql_bind_func(sql, "sys", "isnull", tp, 
NULL, F_FUNC, true, true);
 
                stmt *s = stmt_unop(be, last, NULL, isnil);
 
                sql_subtype *bt = sql_bind_localtype("bit");
-               sql_subfunc *not = sql_bind_func(be->mvc, "sys", "not", bt, 
NULL, F_FUNC, true);
+               sql_subfunc *not = sql_bind_func(be->mvc, "sys", "not", bt, 
NULL, F_FUNC, true, true);
 
                s = stmt_unop(be, s, NULL, not);
                s = stmt_alias(be, s, rnme, nme);
@@ -3414,7 +3414,7 @@ rel2bin_antijoin(backend *be, sql_rel *r
 
                        /* ifthenelse if (not(predicate)) then false else true 
(needed for antijoin) */
                        sql_subtype *bt = sql_bind_localtype("bit");
-                       sql_subfunc *not = sql_bind_func(be->mvc, "sys", "not", 
bt, NULL, F_FUNC, true);
+                       sql_subfunc *not = sql_bind_func(be->mvc, "sys", "not", 
bt, NULL, F_FUNC, true, true);
                        s = stmt_unop(be, s, NULL, not);
                        s = sql_Nop_(be, "ifthenelse", s, stmt_bool(be, 0), 
stmt_bool(be, 1), NULL);
 
@@ -3762,7 +3762,7 @@ rel2bin_single(backend *be, stmt *s)
                stmt *t = n->data;
                const char *rnme = table_name(sql->sa, t);
                const char *nme = column_name(sql->sa, t);
-               sql_subfunc *zero_or_one = sql_bind_func(sql, "sys", 
"zero_or_one", tail_type(t), NULL, F_AGGR, true);
+               sql_subfunc *zero_or_one = sql_bind_func(sql, "sys", 
"zero_or_one", tail_type(t), NULL, F_AGGR, true, true);
 
                t = stmt_aggr(be, t, NULL, NULL, zero_or_one, 1, 0, 1);
                t = stmt_alias(be, t, rnme, nme);
@@ -3931,7 +3931,7 @@ rel2bin_except(backend *be, sql_rel *rel
        lcnt = stmt_append(be, lcnt, ncnt);
        rcnt = stmt_append(be, rcnt, zero);
 
-       min = sql_bind_func(sql, "sys", "sql_sub", lng, lng, F_FUNC, true);
+       min = sql_bind_func_result(sql, "sys", "sql_sub", F_FUNC, true, lng, 2, 
lng, lng);
        s = stmt_binop(be, lcnt, rcnt, NULL, min); /* use count */
 
        /* now we have gid,cnt, blowup to full groupsizes */
@@ -4029,7 +4029,7 @@ rel2bin_inter(backend *be, sql_rel *rel,
        lcnt = stmt_project(be, lm, lcnt);
        rcnt = stmt_project(be, rm, rcnt);
 
-       min = sql_bind_func(sql, "sys", "sql_min", lng, lng, F_FUNC, true);
+       min = sql_bind_func(sql, "sys", "sql_min", lng, lng, F_FUNC, true, 
true);
        s = stmt_binop(be, lcnt, rcnt, NULL, min);
 
        /* now we have gid,cnt, blowup to full groupsizes */
@@ -4619,7 +4619,7 @@ insert_check_ukey(backend *be, list *ins
        stmt *res;
 
        sql_subtype *lng = sql_bind_localtype("lng");
-       sql_subfunc *cnt = sql_bind_func(sql, "sys", "count", 
sql_bind_localtype("void"), NULL, F_AGGR, true);
+       sql_subfunc *cnt = sql_bind_func(sql, "sys", "count", 
sql_bind_localtype("void"), NULL, F_AGGR, true, true);
        sql_subtype *bt = sql_bind_localtype("bit");
        stmt *dels = stmt_tid(be, k->t, 0);
        sql_subfunc *ne = sql_bind_func_result(sql, "sys", "<>", F_FUNC, true, 
bt, 2, lng, lng);
@@ -4709,7 +4709,7 @@ insert_check_ukey(backend *be, list *ins
                        if (!orderby_grp || !orderby_ids)
                                return NULL;
 
-                       sum = sql_bind_func(sql, "sys", "not_unique", 
tail_type(orderby_grp), NULL, F_AGGR, true);
+                       sum = sql_bind_func(sql, "sys", "not_unique", 
tail_type(orderby_grp), NULL, F_AGGR, true, true);
                        ssum = stmt_aggr(be, orderby_grp, NULL, NULL, sum, 1, 
0, 1);
                        /* combine results */
                        s = stmt_binop(be, s, ssum, NULL, or);
@@ -4764,7 +4764,7 @@ insert_check_ukey(backend *be, list *ins
                        g = stmt_group(be, ins, NULL, NULL, NULL, 1);
                        ss = stmt_result(be, g, 2); /* use count */
                        /* (count(ss) <> sum(ss)) */
-                       sum = sql_bind_func(sql, "sys", "sum", lng, NULL, 
F_AGGR, true);
+                       sum = sql_bind_func(sql, "sys", "sum", lng, NULL, 
F_AGGR, true, true);
                        ssum = stmt_aggr(be, ss, NULL, NULL, sum, 1, 0, 1);
                        ssum = sql_Nop_(be, "ifthenelse", sql_unop_(be, 
"isnull", ssum), stmt_atom_lng(be, 0), ssum, NULL);
                        count_sum = stmt_binop(be, check_types(be, 
tail_type(ssum), stmt_aggr(be, ss, NULL, NULL, cnt, 1, 0, 1), type_equal), 
ssum, NULL, ne);
@@ -4789,7 +4789,7 @@ insert_check_fkey(backend *be, list *ins
        char *msg = NULL;
        stmt *cs = list_fetch(inserts, 0), *s = cs;
        sql_subtype *lng = sql_bind_localtype("lng");
-       sql_subfunc *cnt = sql_bind_func(sql, "sys", "count", 
sql_bind_localtype("void"), NULL, F_AGGR, true);
+       sql_subfunc *cnt = sql_bind_func(sql, "sys", "count", 
sql_bind_localtype("void"), NULL, F_AGGR, true, true);
        sql_subtype *bt = sql_bind_localtype("bit");
        sql_subfunc *ne = sql_bind_func_result(sql, "sys", "<>", F_FUNC, true, 
bt, 2, lng, lng);
 
@@ -4934,10 +4934,10 @@ sql_insert_check_null(backend *be, sql_t
                        if (!(s->key && s->nrcols == 0)) {
                                s = stmt_selectnil(be, column(be, i));
                                if (!cnt)
-                                       cnt = sql_bind_func(sql, "sys", 
"count", sql_bind_localtype("void"), NULL, F_AGGR, true);
+                                       cnt = sql_bind_func(sql, "sys", 
"count", sql_bind_localtype("void"), NULL, F_AGGR, true, true);
                                s = stmt_aggr(be, s, NULL, NULL, cnt, 1, 0, 1);
                        } else {
-                               sql_subfunc *isnil = sql_bind_func(sql, "sys", 
"isnull", &c->type, NULL, F_FUNC, true);
+                               sql_subfunc *isnil = sql_bind_func(sql, "sys", 
"isnull", &c->type, NULL, F_FUNC, true, true);
 
                                s = stmt_unop(be, i, NULL, isnil);
                        }
@@ -5013,7 +5013,7 @@ rel2bin_insert(backend *be, sql_rel *rel
        if (insert->nrcols == 0) {
                cnt = stmt_atom_lng(be, 1);
        } else {
-               cnt = stmt_aggr(be, insert, NULL, NULL, sql_bind_func(sql, 
"sys", "count", sql_bind_localtype("void"), NULL, F_AGGR, true), 1, 0, 1);
+               cnt = stmt_aggr(be, insert, NULL, NULL, sql_bind_func(sql, 
"sys", "count", sql_bind_localtype("void"), NULL, F_AGGR, true, true), 1, 0, 1);
        }
        insert = NULL;
 
@@ -5126,7 +5126,7 @@ update_check_ukey(backend *be, stmt **up
        stmt *res = NULL;
 
        sql_subtype *lng = sql_bind_localtype("lng");
-       sql_subfunc *cnt = sql_bind_func(sql, "sys", "count", 
sql_bind_localtype("void"), NULL, F_AGGR, true);
+       sql_subfunc *cnt = sql_bind_func(sql, "sys", "count", 
sql_bind_localtype("void"), NULL, F_AGGR, true, true);
        sql_subtype *bt = sql_bind_localtype("bit");
        sql_subfunc *ne;
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to