Update of /cvsroot/monetdb/sql/src/server
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv27554/src/server

Modified Files:
        Makefile.ag rel_bin.mx sql_atom.mx sql_parser.mx sql_schema.mx 
        sql_select.mx sql_semantic.mx sql_statement.mx sql_symbol.mx 
        sql_updates.mx 
Log Message:
propagated changes of Friday Mar 30 2007 - Monday Apr 02 2007
from the SQL_2-16 branch to the development trunk



Index: sql_semantic.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_semantic.mx,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- sql_semantic.mx     22 Mar 2007 09:26:56 -0000      1.160
+++ sql_semantic.mx     1 Apr 2007 22:08:57 -0000       1.161
@@ -1058,9 +1058,10 @@
        case SQL_ALTER_USER:
        case SQL_CREATE_ROLE:
        case SQL_DROP_ROLE:
-       case SQL_GRANT_ROLES:
        case SQL_GRANT:
        case SQL_REVOKE:
+       case SQL_GRANT_ROLES:
+       case SQL_REVOKE_ROLES:
        case SQL_CREATE_TYPE:
        case SQL_CREATE_TRIGGER:
        case SQL_DROP_TRIGGER:

Index: sql_updates.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_updates.mx,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- sql_updates.mx      30 Mar 2007 14:52:00 -0000      1.110
+++ sql_updates.mx      1 Apr 2007 22:08:57 -0000       1.111
@@ -126,7 +126,7 @@
                                stmt_reljoin_fill(s, stmt_bat(c->c, 
stmt_dup(ts), RDONLY), stmt_dup(inserts[c->c->colnr]->op2.stval));
                        }
                }
-               s = stmt_binop(stmt_aggr(s, NULL, cnt), stmt_atom_int(0), ne);
+               s = stmt_binop(stmt_aggr(s, NULL, cnt, 1), stmt_atom_int(0), 
ne);
 
                /* 2e stage: find out if inserted are unique */
                if (idx_inserts->nrcols) {      /* insert columns not atoms */
@@ -144,7 +144,7 @@
                        }
 
                        sum = sql_bind_aggr(sql->session->schema, "not_unique", 
tail_type(ss));
-                       count_sum = stmt_aggr(ss, NULL, sum);
+                       count_sum = stmt_aggr(ss, NULL, sum, 1);
                        /* combine results */
                        s = stmt_binop(s, count_sum, or);
                }
@@ -164,11 +164,11 @@
                        if (h->nrcols) {
                                s = stmt_join(s, stmt_reverse(stmt_dup(h)), 
cmp_equal);
                                /* s should be empty */
-                               s = stmt_aggr(s, NULL, cnt);
+                               s = stmt_aggr(s, NULL, cnt, 1);
                        } else {
                                s = stmt_uselect(s, stmt_dup(h), cmp_equal);
                                /* s should be empty */
-                               s = stmt_aggr(s, NULL, cnt);
+                               s = stmt_aggr(s, NULL, cnt, 1);
                        }
                        /* s should be empty */
                        s = stmt_binop(s, stmt_atom_int(0), ne);
@@ -185,12 +185,12 @@
 
                        stmt *ins = stmt_dup(inserts[c->c->colnr]->op2.stval);
                        group *g = grp_create(ins, NULL, NULL);
-                       stmt *ss = stmt_aggr(stmt_dup(g->grp), g, 
sql_dup_aggr(cnt));
+                       stmt *ss = stmt_aggr(stmt_dup(g->grp), g, 
sql_dup_aggr(cnt), 1);
 
                        /* (count(ss) <> sum(ss)) */
                        sum = sql_bind_aggr(sql->session->schema, "sum", 
tail_type(ss));
-                       ssum = stmt_aggr(ss, NULL, sum);
-                       count_sum = stmt_binop(check_types(sql, 
tail_type(ssum), stmt_aggr(stmt_dup(ss), NULL, sql_dup_aggr(cnt)), type_equal), 
ssum, sql_dup_func(ne));
+                       ssum = stmt_aggr(ss, NULL, sum, 1);
+                       count_sum = stmt_binop(check_types(sql, 
tail_type(ssum), stmt_aggr(stmt_dup(ss), NULL, sql_dup_aggr(cnt), 1), 
type_equal), ssum, sql_dup_func(ne));
 
                        /* combine results */
                        s = stmt_binop(s, count_sum, or);
@@ -219,12 +219,12 @@
        (void) sql;             /* unused! */
 
        if (s->key && s->nrcols == 0) {
-               s = stmt_binop(stmt_aggr(stmt_dup(idx_inserts), NULL, cnt), 
stmt_atom_int(1), ne);
+               s = stmt_binop(stmt_aggr(stmt_dup(idx_inserts), NULL, cnt, 1), 
stmt_atom_int(1), ne);
        } else {
                /* reljoin.count <> inserts[col1].count */
                stmt *ins = stmt_dup(inserts[0]->op2.stval);
 
-               s = stmt_binop(stmt_aggr(stmt_dup(idx_inserts), NULL, cnt), 
stmt_aggr(ins, NULL, sql_dup_aggr(cnt)), ne);
+               s = stmt_binop(stmt_aggr(stmt_dup(idx_inserts), NULL, cnt, 1), 
stmt_aggr(ins, NULL, sql_dup_aggr(cnt), 1), ne);
        }
 
        /* s should be empty */
@@ -573,7 +573,7 @@
                        stmt_reljoin_fill(s, l, upd);
 
                }
-               s = stmt_binop(stmt_aggr(s, NULL, cnt), stmt_atom_int(0), ne);
+               s = stmt_binop(stmt_aggr(s, NULL, cnt, 1), stmt_atom_int(0), 
ne);
 
                /* 2e stage: find out if the updated are unique */
                if (idx_updates->nrcols) {      /* update columns not atoms */
@@ -598,11 +598,11 @@
                                }
                                g = grp_create(upd, g, NULL);
                        }
-                       ss = stmt_aggr(stmt_dup(g->grp), grp_dup(g), 
sql_dup_aggr(cnt));
+                       ss = stmt_aggr(stmt_dup(g->grp), grp_dup(g), 
sql_dup_aggr(cnt), 1);
                        grp_destroy(g);
                        /* (count(ss) <> sum(ss)) */
                        sum = sql_bind_aggr(sql->session->schema, "sum", 
tail_type(ss));
-                       count_sum = stmt_binop(stmt_aggr(stmt_dup(ss), NULL, 
sql_dup_aggr(cnt)), check_types(sql, it, stmt_aggr(ss, NULL, sum), type_equal), 
sql_dup_func(ne));
+                       count_sum = stmt_binop(stmt_aggr(stmt_dup(ss), NULL, 
sql_dup_aggr(cnt), 1), check_types(sql, it, stmt_aggr(ss, NULL, sum, 1), 
type_equal), sql_dup_func(ne));
 
                        /* combine results */
                        s = stmt_binop(s, count_sum, or);
@@ -621,7 +621,7 @@
                stmt *s = stmt_join(o, stmt_reverse(h), cmp_equal);
 
                /* s should be empty */
-               s = stmt_binop(stmt_aggr(s, NULL, cnt), stmt_atom_int(0), ne);
+               s = stmt_binop(stmt_aggr(s, NULL, cnt, 1), stmt_atom_int(0), 
ne);
 
                /* 2e stage: find out if updated are unique */
                if (h->nrcols) {        /* update columns not atoms */
@@ -632,12 +632,12 @@
 
                        stmt *upd = stmt_dup(updates[c->c->colnr]->op2.stval);
                        group *g = grp_create(upd, NULL, NULL);
-                       stmt *ss = stmt_aggr(stmt_dup(g->grp), g, 
sql_dup_aggr(cnt));
+                       stmt *ss = stmt_aggr(stmt_dup(g->grp), g, 
sql_dup_aggr(cnt), 1);
 
                        /* (count(ss) <> sum(ss)) */
                        sum = sql_bind_aggr(sql->session->schema, "sum", 
tail_type(ss));
-                       ssum = stmt_aggr(ss, NULL, sum);
-                       count_sum = stmt_binop(check_types(sql, 
tail_type(ssum), stmt_aggr(stmt_dup(ss), NULL, sql_dup_aggr(cnt)), type_equal), 
ssum, sql_dup_func(ne));
+                       ssum = stmt_aggr(ss, NULL, sum, 1);
+                       count_sum = stmt_binop(check_types(sql, 
tail_type(ssum), stmt_aggr(stmt_dup(ss), NULL, sql_dup_aggr(cnt), 1), 
type_equal), ssum, sql_dup_func(ne));
 
                        /* combine results */
                        s = stmt_binop(s, count_sum, or);
@@ -669,7 +669,7 @@
        (void) sql;             /* unused! */
        /* reljoin.count <> updates[updcol].count */
        cur = stmt_dup(updates[updcol]->op2.stval);
-       s = stmt_binop(stmt_aggr(stmt_dup(idx_updates), NULL, cnt), 
stmt_aggr(cur, NULL, sql_dup_aggr(cnt)), ne);
+       s = stmt_binop(stmt_aggr(stmt_dup(idx_updates), NULL, cnt, 1), 
stmt_aggr(cur, NULL, sql_dup_aggr(cnt), 1), ne);
 
        /* s should be empty */
        snprintf(buf, BUFSIZ, "UPDATE: FOREIGN KEY constraint '%s.%s' 
violated", k->t->base.name, k->base.name);
@@ -729,7 +729,7 @@
        stmt_destroy(fts);
 
        /* reljoin.count <> updates[updcol].count */
-       s = stmt_binop(stmt_aggr(stmt_dup(s), NULL, cnt), stmt_aggr(rows, NULL, 
sql_dup_aggr(cnt)), ne);
+       s = stmt_binop(stmt_aggr(stmt_dup(s), NULL, cnt, 1), stmt_aggr(rows, 
NULL, sql_dup_aggr(cnt), 1), ne);
 
        /* s should be empty */
        snprintf(buf, BUFSIZ, "UPDATE: FOREIGN KEY constraint '%s.%s' 
violated", k->t->base.name, k->base.name);
@@ -1149,7 +1149,7 @@
                        if (!(s->key && s->nrcols == 0)) {
                                s = stmt_atom(atom_general(&c->type, NULL, 0));
                                s = 
stmt_uselect(stmt_dup(inserts[c->colnr]->op2.stval), s, cmp_equal);
-                               s = stmt_aggr(s, NULL, sql_dup_aggr(cnt));
+                               s = stmt_aggr(s, NULL, sql_dup_aggr(cnt), 1);
                        } else {
                                sql_subfunc *isnil = 
sql_bind_func(sql->session->schema, "isnull", &c->type, NULL);
 
@@ -1175,7 +1175,7 @@
                if (inserts[0]->op2.stval->nrcols == 0) {
                        s = stmt_atom_int(1);
                } else {
-                       s = stmt_aggr(stmt_dup(inserts[0]->op2.stval), NULL, 
sql_bind_aggr(sql->session->schema, "count", NULL));
+                       s = stmt_aggr(stmt_dup(inserts[0]->op2.stval), NULL, 
sql_bind_aggr(sql->session->schema, "count", NULL), 1);
                }
                list_append(l, stmt_affected_rows(s));
        }
@@ -1513,7 +1513,7 @@
                        if (!(s->key && s->nrcols == 0)) {
                                s = stmt_atom(atom_general(&c->type, NULL, 0));
                                s = 
stmt_uselect(stmt_dup(updates[c->colnr]->op2.stval), s, cmp_equal);
-                               s = stmt_aggr(s, NULL, sql_dup_aggr(cnt));
+                               s = stmt_aggr(s, NULL, sql_dup_aggr(cnt), 1);
                        } else {
                                sql_subfunc *isnil = 
sql_bind_func(sql->session->schema, "isnull", &c->type, NULL);
 
@@ -1661,7 +1661,7 @@
                                updates[c->colnr] = stmt_insert(stmt_bat(c, 
stmt_dup(tv->s), UPD), stmt_dup(v));
                        list_append(l, stmt_dup(updates[c->colnr]));
                }
-               list_append(l, stmt_affected_rows(stmt_aggr(first_subset(s), 
NULL, sql_bind_aggr(sql->session->schema, "count", NULL))));
+               list_append(l, stmt_affected_rows(stmt_aggr(first_subset(s), 
NULL, sql_bind_aggr(sql->session->schema, "count", NULL), 1)));
                stmt_destroy(s);
 
                if ((s = sql_update(sql, schema, t, updates, l)) == NULL) {
@@ -1818,7 +1818,7 @@
                                        break;
                                default:        /*RESTRICT*/
                                        /* The overlap between deleted 
primaries and foreign should be empty */
-                                       s = stmt_binop(stmt_aggr(s, NULL, cnt), 
stmt_atom_int(0), ne);
+                                       s = stmt_binop(stmt_aggr(s, NULL, cnt, 
1), stmt_atom_int(0), ne);
                                        snprintf(buf, BUFSIZ, "DELETE: FOREIGN 
KEY constraint '%s.%s' violated", k->t->base.name, k->base.name);
                                        s = stmt_exception(s, _strdup(buf), 
00001);
                                        list_prepend(l, s);
@@ -1902,7 +1902,7 @@
        if (output) {
                if (!all) 
                        s = stmt_aggr(stmt_dup(subset), NULL,
-                           sql_bind_aggr(sql->session->schema, "count", NULL));
+                           sql_bind_aggr(sql->session->schema, "count", NULL), 
1);
                list_append(l, stmt_affected_rows(s));
        }
        return stmt_list(l);

Index: sql_select.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_select.mx,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -d -r1.180 -r1.181
--- sql_select.mx       30 Mar 2007 17:49:10 -0000      1.180
+++ sql_select.mx       1 Apr 2007 22:08:57 -0000       1.181
@@ -1123,7 +1123,7 @@
                }
                if (grp) {
                        a = sql_bind_aggr(schema, aggrstr, NULL);
-                       return stmt_aggr(stmt_dup(grp->grp), grp_dup(grp), a);
+                       return stmt_aggr(stmt_dup(grp->grp), grp_dup(grp), a, 
1);
                }
                cv = scope_first_column(scp);
                if (cv && subset) {
@@ -1139,7 +1139,7 @@
                                s = stmt_unique(s, NULL);
                        }
                        a = sql_bind_aggr(schema, aggrstr, NULL);
-                       return stmt_aggr(stmt_alias(s,NULL,_strdup("")),NULL,a);
+                       return 
stmt_aggr(stmt_alias(s,NULL,_strdup("")),NULL,a,1);
                } else if (!cv) { /* count(*) without from */
                        /* if we have a where (boolean only) */
                        if (!(s = scope_bind(scp, NULL, "row"))) 
@@ -1182,7 +1182,7 @@
                        stmt *n = stmt_atom(atom_general(t, NULL, 0));
                        s = stmt_select2(s, n, stmt_dup(n), 0);
                }
-               return fix_scale(sql, t, stmt_aggr(s, grp_dup(grp), a), 1, 
(t->type->scale == SCALE_FIX));
+               return fix_scale(sql, t, stmt_aggr(s, grp_dup(grp), a, 1), 1, 
(t->type->scale == SCALE_FIX));
        } else {
                char *type = tail_type(s)->type->sqlname;
 
@@ -1419,10 +1419,22 @@
                        s = first_subset(subset);
                else if (!s)
                        return s;
-               s = stmt_mark(s, 0);
+               if (grp) {
+                       sql_subaggr *a = sql_bind_aggr(sql->session->schema, 
aggrstr, NULL);
+                       if (!a)
+                               return sql_error(sql, 02, "SELECT: function 
'%s' not found", aggrstr );
+                       s = stmt_aggr(stmt_dup(grp->grp), grp_dup(grp), a, 0);
+               } else if (aggrstr) {
+                       sql_subaggr *a = sql_bind_aggr(sql->session->schema, 
aggrstr, NULL);
+                       if (!a)
+                               return sql_error(sql, 02, "SELECT: function 
'%s' not found", aggrstr );
+                       s = stmt_aggr(s, NULL, a, 0);
+               } else {
+                       assert(0);
+                       s = stmt_mark(stmt_reverse(s), 0);
+               }
        } else {
                s = sql_aggrop(sql, scp, window_function, grp, subset, f);
-               return s;
        }
        return s;
 }
@@ -1556,7 +1568,7 @@
                                        
                                        sql_subaggr *zero_or_one = 
sql_bind_aggr(sql->session->schema, "zero_or_one", tail_type(s));
                                        assert(zero_or_one);
-                                       s = stmt_aggr(s, NULL, zero_or_one);
+                                       s = stmt_aggr(s, NULL, zero_or_one, 1);
                                        /* we aggregated in the subquery not 
                                           in the outer */
                                        s->aggr = 0;
@@ -1984,9 +1996,9 @@
                        rgrp = grp_create(r, rgrp, NULL);
                }
                a = sql_bind_aggr(sql->session->schema, "count", NULL);
-               ls = stmt_aggr(stmt_dup(lgrp->grp), grp_dup(lgrp), a); 
+               ls = stmt_aggr(stmt_dup(lgrp->grp), grp_dup(lgrp), a, 1); 
                a = sql_dup_aggr(a);
-               rs = stmt_aggr(stmt_dup(rgrp->grp), grp_dup(rgrp), a); 
+               rs = stmt_aggr(stmt_dup(rgrp->grp), grp_dup(rgrp), a, 1); 
 
                /* now find the matching groups */
                s = stmt_reljoin_init();
@@ -2094,9 +2106,9 @@
                        rgrp = grp_create(r, rgrp, NULL);
                }
                a = sql_bind_aggr(sql->session->schema, "count", NULL);
-               ls = stmt_aggr(stmt_dup(lgrp->grp), grp_dup(lgrp), a); 
+               ls = stmt_aggr(stmt_dup(lgrp->grp), grp_dup(lgrp), a, 1); 
                a = sql_dup_aggr(a);
-               rs = stmt_aggr(stmt_dup(rgrp->grp), grp_dup(rgrp), a); 
+               rs = stmt_aggr(stmt_dup(rgrp->grp), grp_dup(rgrp), a, 1); 
 
                /* now find the matching groups */
                s = stmt_reljoin_init();
@@ -2604,7 +2616,7 @@
                        if (!sqa->key) {
                                sql_subaggr *zero_or_one = 
sql_bind_aggr(sql->session->schema, "zero_or_one", tail_type(sqa));
                                assert(zero_or_one);
-                               sqa = stmt_aggr(sqa, NULL, zero_or_one);
+                               sqa = stmt_aggr(sqa, NULL, zero_or_one, 1);
                                /* we aggregated in the subquery not in the 
outer */
                                sqa->aggr = 0;
                        }
@@ -2649,7 +2661,7 @@
                                        if (!cmp->key) {
                                                sql_subaggr *zero_or_one = 
sql_bind_aggr(sql->session->schema, "zero_or_one", tail_type(cmp));
                                                assert(zero_or_one);
-                                               cmp = stmt_aggr(cmp, NULL, 
zero_or_one);
+                                               cmp = stmt_aggr(cmp, NULL, 
zero_or_one, 1);
                                                /* we aggregated in the 
subquery not in the outer */
                                                cmp->aggr = 0;
                                        }
@@ -3196,7 +3208,7 @@
                        }
                        cnt = sql_bind_aggr(sql->session->schema, "count", 
NULL);
                        res = stmt_dup(s);
-                       res = stmt_aggr(res, NULL, cnt);
+                       res = stmt_aggr(res, NULL, cnt, 1);
                        if (sc->token == SQL_EXISTS) {
                                sql_subfunc *ne = 
sql_bind_func_result(sql->session->schema, "<>", it, it, bt);
 

Index: sql_schema.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_schema.mx,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- sql_schema.mx       28 Mar 2007 14:54:24 -0000      1.119
+++ sql_schema.mx       1 Apr 2007 22:08:57 -0000       1.120
@@ -118,7 +118,8 @@
                for (g = grantees->h; g; g = g->next) {
                        char *grantee = g->data.sval;
 
-                       sql_revoke_role(sql, grantee, role);
+                       if (sql_revoke_role(sql, grantee, role) == FALSE) 
+                               return sql_error(sql, 02, "REVOKE no such role 
'%s' or grantee '%s'", role, grantee);
                }
        }
        return stmt_none();

Index: sql_atom.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_atom.mx,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- sql_atom.mx 9 Feb 2007 23:19:39 -0000       1.52
+++ sql_atom.mx 1 Apr 2007 22:08:56 -0000       1.53
@@ -119,7 +119,7 @@
                }
                a->data.len = 0;
                if (atom_debug)
-                       fprintf(stderr, "atom_int(%s,%lld)\n", 
tpe->type->sqlname, val);
+                       fprintf(stderr, "atom_int(%s,"LLFMT")\n", 
tpe->type->sqlname, val);
                return a;
        }
        return NULL;
@@ -244,7 +244,7 @@
 
        switch (a->data.vtype) { 
        case TYPE_lng:
-               sprintf(buf, "%lld", a->data.val.lval);
+               sprintf(buf, LLFMT, a->data.val.lval);
                break;
        case TYPE_int:
                sprintf(buf, "%d", a->data.val.ival);
@@ -301,7 +301,7 @@
        case EC_NUM:
                switch (a->data.vtype) {
                case TYPE_lng:
-                       sprintf(buf, "%lld", a->data.val.lval);
+                       sprintf(buf, LLFMT, a->data.val.lval);
                        break;
                case TYPE_int:
                        sprintf(buf, "%d", a->data.val.ival);
@@ -443,7 +443,7 @@
                if (at->type->eclass == EC_DEC && tp->type->eclass == EC_DEC &&
                    at->type->localtype <= tp->type->localtype &&
                    at->type->digits <= tp->type->digits &&
-                   at->type->scale <= tp->type->scale) {
+                   at->scale <= tp->scale) {
                        lng mul = 1;
                        /* cast numerics */
                        switch( tp->type->localtype) {
@@ -464,10 +464,10 @@
                        default:
                                return 0;
                        }
+                       /* fix scale */
+                       mul = scales[tp->scale-at->scale];
                        a->tpe = *tp;
                        a->data.vtype = tp->type->localtype;
-                       /* fix scale */
-                       mul = scales[tp->type->scale-at->type->scale];
                        if (a->data.vtype == TYPE_lng)
                                a->data.val.lval *= mul;
                        else if (a->data.vtype == TYPE_int)

Index: sql_statement.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_statement.mx,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- sql_statement.mx    30 Mar 2007 17:49:10 -0000      1.144
+++ sql_statement.mx    1 Apr 2007 22:08:57 -0000       1.145
@@ -271,7 +271,7 @@
 extern stmt *stmt_unop(stmt *op1, sql_subfunc *op);
 extern stmt *stmt_binop(stmt *op1, stmt *op2, sql_subfunc *op);
 extern stmt *stmt_Nop(stmt *ops, sql_subfunc *op);
-extern stmt *stmt_aggr(stmt *op1, group *grp, sql_subaggr *op);
+extern stmt *stmt_aggr(stmt *op1, group *grp, sql_subaggr *op, int reduce);
 extern stmt *stmt_aggr2(stmt *op1, stmt *op2, sql_subaggr *op);
 extern stmt *stmt_unique(stmt *s, group *grp);
 
@@ -1934,7 +1934,7 @@
 }
 
 stmt *
-stmt_aggr(stmt *op1, group *grp, sql_subaggr *op)
+stmt_aggr(stmt *op1, group *grp, sql_subaggr *op, int reduce)
 {
        stmt *s = stmt_create(st_aggr);
 
@@ -1946,11 +1946,12 @@
                s->h = stmt_dup(grp->grp->h);
                grp_destroy(grp);
        } else {
-               s->nrcols = 0;
+               if (!reduce)
+                       s->nrcols = 1;
                s->h = stmt_dup(op1->h);
        }
-       s->key = 1;
-       s->aggr = 1;
+       s->key = reduce;
+       s->aggr = reduce;
        s->op4.aggrval = op;
        s->flag = 0;
        return s;
@@ -2111,7 +2112,6 @@
        case st_insert:
        case st_replace:
        case st_pivot:
-       case st_mark:
        case st_gen_group:
        case st_group:
        case st_group_ext:
@@ -2124,6 +2124,7 @@
        case st_list:
                return head_type(st->op1.lval->h->data);
 
+       case st_mark:
        case st_temp:
        case st_bat:
        case st_idxbat:

Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/Makefile.ag,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- Makefile.ag 3 Jan 2007 12:39:45 -0000       1.66
+++ Makefile.ag 1 Apr 2007 22:08:56 -0000       1.67
@@ -24,11 +24,11 @@
 #  (At least on Fedora Core 4,) bison 2.0 seems to generate code
 #  that icc does not like; since the problem only occurs with
 #  sql/src/server/sql_parser.mx & amdb/src/lang/parser.y,
-#  we "mis-use" the NO_INLINE_CFLAGS
+#  we use ICC_BISON_CFLAGS
 #  to disable the respective warning as locally as possible
 #  via "-wd592" (#592: variable "." is used before its value is set)
 #  (see also MonetDB/conf/monet.m4 & amdb/src/lang/Makefile.ag).
-CFLAGS = $(NO_INLINE_CFLAGS)
+CFLAGS = $(ICC_BISON_CFLAGS)
 
 lib_sqlserver = {
        NOINST

Index: sql_symbol.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_symbol.mx,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- sql_symbol.mx       20 Mar 2007 18:26:03 -0000      1.29
+++ sql_symbol.mx       1 Apr 2007 22:08:57 -0000       1.30
@@ -155,7 +155,7 @@
                symbol_init(s, token, type_int);
                s->data.ival = data;
                if (symbol_debug)
-                       fprintf(stderr, "%ld = symbol_create_int(%s,%lld)\n", 
(long) s, token2string(s->token), data);
+                       fprintf(stderr, "%ld = 
symbol_create_int(%s,"LLFMT")\n", (long) s, token2string(s->token), data);
        }
        return s;
 }

Index: sql_parser.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_parser.mx,v
retrieving revision 1.239
retrieving revision 1.240
diff -u -d -r1.239 -r1.240
--- sql_parser.mx       28 Mar 2007 14:54:24 -0000      1.239
+++ sql_parser.mx       1 Apr 2007 22:08:57 -0000       1.240
@@ -269,7 +269,7 @@
        index_def
        seq_def
        all_or_any_predicate
-       atom_exp
+       like_exp
        between_predicate
        comparison_predicate
        opt_from_clause
@@ -343,7 +343,6 @@
        value_exp
        column_exp
        atom
-       atom2
        insert_atom
        simple_atom
        literal
@@ -904,7 +903,7 @@
          append_list(l, $5);
          append_int(l, $6);
          append_int(l, $2);
-       $$ = _symbol_create_list( SQL_REVOKE, l); }
+       $$ = _symbol_create_list( SQL_REVOKE_ROLES, l); }
  ;
 
 opt_grant_for:
@@ -2934,29 +2933,24 @@
  ;
 
 like_predicate:
-    pred_exp NOT LIKE atom_exp
+    pred_exp NOT LIKE like_exp
                { dlist *l = L();
                  append_symbol(l, $1);
                  append_symbol(l, $4);
                  $$ = _symbol_create_list(SQL_NOT_LIKE, l ); }
- |  pred_exp LIKE atom_exp
+ |  pred_exp LIKE like_exp
                { dlist *l = L();
                  append_symbol(l, $1);
                  append_symbol(l, $3);
                  $$ = _symbol_create_list(SQL_LIKE, l ); }
  ;
 
-atom2:
-       '(' atom ')'    { $$ = $2; }
- |     atom
- ;
-
-atom_exp:
-    atom2
+like_exp:
+    scalar_exp
        { dlist *l = L();
          append_symbol(l, $1);
          $$ = _symbol_create_list(SQL_ESCAPE, l ); }
- |  atom2 ESCAPE string
+ |  scalar_exp ESCAPE string
        { char *s = sql2str($3);
          if (_strlen(s) != 1) {
                char buf[BUFSIZ];
@@ -2971,10 +2965,6 @@
                $$ = _symbol_create_list(SQL_ESCAPE, l);
          }
        }
- |  '?'        
-       { dlist *l = L();
-         append_symbol(l, _symbol_create( SQL_PARAMETER, NULL ));
-         $$ = _symbol_create_list(SQL_ESCAPE, l ); }
  ;
 
 test_for_null:
@@ -3961,7 +3951,7 @@
                        { if ($3 > 18) {
                                char buf[BUFSIZ];
 
-                               snprintf(buf, BUFSIZ, "decimal of %lld digits 
are not supported", $3);
+                               snprintf(buf, BUFSIZ, "decimal of " LLFMT " 
digits are not supported", $3);
                                yyerror(buf);
                                $$.type = NULL;
                                YYABORT;
@@ -3974,9 +3964,9 @@
                                char buf[BUFSIZ];
 
                                if ($5 >= $3)
-                                       snprintf(buf, BUFSIZ, "scale (%lld) 
should be less than precision (%lld)", $5, $3);
+                                       snprintf(buf, BUFSIZ, "scale (" LLFMT 
") should be less than precision (" LLFMT ")", $5, $3);
                                else
-                                       snprintf(buf, BUFSIZ, 
"decimal(%lld,%lld) isn't supported", $5, $3);
+                                       snprintf(buf, BUFSIZ, "decimal(" LLFMT 
","LLFMT") isn't supported because P="LLFMT" + S="LLFMT" > 18", $3, $5, $3, $5);
                                yyerror(buf);
                                $$.type = NULL;
                                YYABORT;
@@ -4002,7 +3992,7 @@
                        { if ($5 >= $3) {
                                char buf[BUFSIZ];
 
-                               snprintf(buf, BUFSIZ, "precision(%lld) should 
be less than number of digits(%lld)", $5, $3);
+                               snprintf(buf, BUFSIZ, "precision(" LLFMT ") 
should be less than number of digits(" LLFMT ")", $5, $3);
                                yyerror(buf);
                                $$.type = NULL;
                                YYABORT;
@@ -4033,7 +4023,7 @@
                        { if ($5 >= $3) {
                                char buf[BUFSIZ];
 
-                               snprintf(buf, BUFSIZ, "precision(%lld) should 
be less than number of digits(%lld)", $5, $3);
+                               snprintf(buf, BUFSIZ, "precision(" LLFMT ") 
should be less than number of digits(" LLFMT ")", $5, $3);
                                yyerror(buf);
                                $$.type = NULL;
                                YYABORT;

Index: rel_bin.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/rel_bin.mx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- rel_bin.mx  3 Jan 2007 12:39:46 -0000       1.26
+++ rel_bin.mx  1 Apr 2007 22:08:56 -0000       1.27
@@ -202,7 +202,7 @@
                if (as2) 
                        s = stmt_aggr2(stmt_reverse(as), as2, sql_dup_aggr(a) );
                else
-                       s = stmt_aggr(as, g, sql_dup_aggr(a) );
+                       s = stmt_aggr(as, g, sql_dup_aggr(a), 1 );
        }       break;
        case e_relation: {
                stmt *r = NULL;
@@ -610,9 +610,9 @@
                rgrp = grp_create(column(n->data), rgrp, NULL);
 
        a = sql_bind_aggr(sql->session->schema, "count", NULL);
-       ls = stmt_aggr(stmt_dup(lgrp->grp), grp_dup(lgrp), a); 
+       ls = stmt_aggr(stmt_dup(lgrp->grp), grp_dup(lgrp), a, 1); 
        a = sql_dup_aggr(a);
-       rs = stmt_aggr(stmt_dup(rgrp->grp), grp_dup(rgrp), a); 
+       rs = stmt_aggr(stmt_dup(rgrp->grp), grp_dup(rgrp), a, 1); 
 
        /* now find the matching groups */
        s = stmt_reljoin_init();
@@ -725,9 +725,9 @@
                rgrp = grp_create(column(n->data), rgrp, NULL);
 
        a = sql_bind_aggr(sql->session->schema, "count", NULL);
-       ls = stmt_aggr(stmt_dup(lgrp->grp), grp_dup(lgrp), a); 
+       ls = stmt_aggr(stmt_dup(lgrp->grp), grp_dup(lgrp), a, 1); 
        a = sql_dup_aggr(a);
-       rs = stmt_aggr(stmt_dup(rgrp->grp), grp_dup(rgrp), a); 
+       rs = stmt_aggr(stmt_dup(rgrp->grp), grp_dup(rgrp), a, 1); 
 
        /* now find the matching groups */
        s = stmt_reljoin_init();


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to