Changeset: f528a00bd4b9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f528a00bd4b9
Modified Files:
sql/server/rel_psm.c
Branch: Jul2021
Log Message:
Fix for bug #7116 Test for ambiguous function calls only at creation time. Also
ignore it on replace situations
diffs (46 lines):
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
@@ -849,19 +849,6 @@ rel_create_func(sql_query *query, dlist
return sql_error(sql, ERR_NOTFOUND, SQLSTATE(3F000) "CREATE %s:
no such schema '%s'", F, sname);
type_list = create_type_list(sql, params, 1);
- if (type == F_FUNC || type == F_AGGR || type == F_FILT) {
- sql_ftype ftpyes[3] = {F_FUNC, F_AGGR, F_FILT};
-
- for (int i = 0; i < 3; i++) {
- if (ftpyes[i] != type) {
- if (sql_bind_func_(sql, s->base.name, fname,
type_list, ftpyes[i]))
- return sql_error(sql, 02,
SQLSTATE(42000) "CREATE %s: there's %s with the name '%s' and the same
parameters, which causes ambiguous calls", F,
-
(ftpyes[i] == F_AGGR) ? "an aggregate" : (ftpyes[i] == F_FILT) ? "a filter
function" : "a function", fname);
- sql->session->status = 0; /* if the function
was not found clean the error */
- sql->errstr[0] = '\0';
- }
- }
- }
if ((sf = sql_bind_func_(sql, s->base.name, fname, type_list, type)) !=
NULL && create) {
if (replace) {
@@ -901,6 +888,22 @@ rel_create_func(sql_query *query, dlist
sql->session->status = 0; /* if the function was not found
clean the error */
sql->errstr[0] = '\0';
}
+
+ if (create && (type == F_FUNC || type == F_AGGR || type == F_FILT)) {
+ sql_ftype ftpyes[3] = {F_FUNC, F_AGGR, F_FILT};
+
+ for (int i = 0; i < 3; i++) {
+ if (ftpyes[i] != type) {
+ sql_subfunc *found = NULL;
+ if ((found = sql_bind_func_(sql, s->base.name,
fname, type_list, ftpyes[i])))
+ return sql_error(sql, 02,
SQLSTATE(42000) "CREATE %s: there's %s with the name '%s' and the same
parameters, which causes ambiguous calls", F,
+
IS_AGGR(found->func) ? "an aggregate" : IS_FILT(found->func) ? "a filter
function" : "a function", fname);
+ sql->session->status = 0; /* if the function
was not found clean the error */
+ sql->errstr[0] = '\0';
+ }
+ }
+ }
+
list_destroy(type_list);
if (create && !mvc_schema_privs(sql, s)) {
return sql_error(sql, 02, SQLSTATE(42000) "CREATE %s:
insufficient privileges for user '%s' in schema '%s'", F,
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list