Changeset: 23e1231ada99 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=23e1231ada99
Modified Files:
monetdb5/modules/atoms/uuid.mal
sql/storage/store.c
Branch: Aug2018
Log Message:
fixes for bug 6645, ie make sure we call uuid per row (do not reduce
the number of calls using any of the common expression optimizers)
diffs (49 lines):
diff --git a/monetdb5/modules/atoms/uuid.mal b/monetdb5/modules/atoms/uuid.mal
--- a/monetdb5/modules/atoms/uuid.mal
+++ b/monetdb5/modules/atoms/uuid.mal
@@ -13,10 +13,15 @@ command write() address UUIDwrite;
command prelude():void address UUIDprelude;
uuid.prelude();
-command new() :uuid
+# unsafe is to prevent optimizers to reuse common expressions
+unsafe command new() :uuid
address UUIDgenerateUuid
comment "Generate a new uuid";
+unsafe command new(d:int) :uuid
+address UUIDgenerateUuid
+comment "Generate a new uuid (dummy version for side effect free multiplex
loop)";
+
command uuid(s:str):uuid
address UUIDstr2uuid
comment "Coerce a string to a uuid, validating its format";
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -808,6 +808,7 @@ load_func(sql_trans *tr, sql_schema *s,
}
if (t->type == F_FUNC && !t->res)
t->type = F_PROC;
+ t->side_effect = (t->type==F_FILT || (t->res && (t->lang==FUNC_LANG_SQL
|| !list_empty(t->ops))))?FALSE:TRUE;
return t;
}
@@ -4171,7 +4172,7 @@ create_sql_func(sql_allocator *sa, const
t->type = type;
t->lang = lang;
t->sql = (lang==FUNC_LANG_SQL||lang==FUNC_LANG_MAL);
- t->side_effect = (type==F_FILT||res)?FALSE:TRUE;
+ t->side_effect = (type==F_FILT || (res && (lang==FUNC_LANG_SQL ||
!list_empty(args))))?FALSE:TRUE;
t->varres = varres;
t->vararg = vararg;
t->ops = args;
@@ -4199,7 +4200,7 @@ sql_trans_create_func(sql_trans *tr, sql
t->type = type;
t->lang = lang;
t->sql = (lang==FUNC_LANG_SQL||lang==FUNC_LANG_MAL);
- se = t->side_effect = (type==F_FILT||res)?FALSE:TRUE;
+ se = t->side_effect = (type==F_FILT || (res && (lang==FUNC_LANG_SQL ||
!list_empty(args))))?FALSE:TRUE;
t->varres = varres;
t->vararg = vararg;
t->ops = sa_list(tr->sa);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list