Changeset: 6f5be453066b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6f5be453066b
Modified Files:
sql/server/rel_select.c
Branch: default
Log Message:
First check if aggregate inputs are compatible, then if user has privilege to
call it
diffs (75 lines):
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
@@ -3751,16 +3751,15 @@ static sql_exp *
&((sql_arg*)a->func->ops->h->next->data)->type) != 0) ) {
if (a) {
list *nexps = NULL;
- found = true; /* something was found */
-
- if (!execute_priv(sql, a->func)) {
- a = NULL;
- } else if (!list_empty(exps) && !(nexps =
check_arguments_and_find_largest_any_type(sql, *rel, exps, a, 0))) {
+
+ if (!list_empty(exps) && !(nexps =
check_arguments_and_find_largest_any_type(sql, *rel, exps, a, 0))) {
a = NULL;
/* reset error */
sql->session->status = 0;
sql->errstr[0] = '\0';
- found = false; /* reset found */
+ } else if (!execute_priv(sql, a->func)) {
+ found = true; /* something was found */
+ a = NULL;
} else
exps = nexps;
} else {
@@ -3823,15 +3822,14 @@ static sql_exp *
a = sql_bind_func_(sql, sname, aname,
exp_types(sql->sa, nexps), F_AGGR, false);
if (a) {
- found = true; /* something was found */
- if (!execute_priv(sql, a->func))
- a = NULL;
- else if (!list_empty(exps) && !(nexps =
check_arguments_and_find_largest_any_type(sql, *rel, exps, a, 0))) {
+ if (!list_empty(exps) && !(nexps =
check_arguments_and_find_largest_any_type(sql, *rel, exps, a, 0))) {
a = NULL;
/* reset error */
sql->session->status = 0;
sql->errstr[0] = '\0';
- found = false; /* reset found */
+ } else if (!execute_priv(sql, a->func)) {
+ found = true; /* something was found */
+ a = NULL;
} else
exps = nexps;
} else {
@@ -3849,22 +3847,19 @@ static sql_exp *
list *aggrs = sql_find_funcs(sql, sname, aname,
list_length(exps), F_AGGR, false);
if (!list_empty(aggrs)) {
- for (node *m = aggrs->h ; m; m = m->next) {
+ for (node *n = aggrs->h ; n && !a; n = n->next) {
list *nexps = NULL;
- a = (sql_subfunc *) m->data;
- found = true; /* something was found */
-
- if (!execute_priv(sql, a->func)) {
- a = NULL;
- } else if (!list_empty(exps) && !(nexps =
check_arguments_and_find_largest_any_type(sql, *rel, exps, a, 0))) {
- a = NULL;
+ sql_subfunc *sf = (sql_subfunc *) n->data;
+
+ if (!list_empty(exps) && !(nexps =
check_arguments_and_find_largest_any_type(sql, *rel, exps, sf, 0))) {
/* reset error */
sql->session->status = 0;
sql->errstr[0] = '\0';
- found = false; /* reset found */
+ } else if (!execute_priv(sql, sf->func)) {
+ found = true; /* something was found */
} else {
+ a = sf;
exps = nexps;
- break;
}
}
} else {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]