Changeset: 97671dd5d66d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/97671dd5d66d
Modified Files:
monetdb5/mal/mal_session.c
monetdb5/optimizer/opt_wrapper.c
Branch: Jun2023
Log Message:
Return errors in the expected way (as return value, not in the mal block).
diffs (43 lines):
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -916,6 +916,11 @@ optimizeMALBlock(Client cntxt, MalBlkPtr
if (getModuleId(p) == optimizerRef && p->fcn && p->token !=
REMsymbol) {
actions++;
msg = (*(str (*)(Client, MalBlkPtr, MalStkPtr,
InstrPtr))p->fcn)(cntxt, mb, 0, p);
+ if (mb->errors) {
+ freeException(msg);
+ msg = mb->errors;
+ mb->errors = NULL;
+ }
if (msg) {
str place = getExceptionPlace(msg);
str nmsg = NULL;
diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c
--- a/monetdb5/optimizer/opt_wrapper.c
+++ b/monetdb5/optimizer/opt_wrapper.c
@@ -111,8 +111,11 @@ OPTwrapper(Client cntxt, MalBlkPtr mb, M
if( p == NULL)
throw(MAL, "opt_wrapper", SQLSTATE(HY002) "missing optimizer
statement");
- if( mb->errors)
- throw(MAL, "opt_wrapper", SQLSTATE(42000) "MAL block contains
errors");
+ if (mb->errors) {
+ msg = mb->errors;
+ mb->errors = NULL;
+ return msg;
+ }
fcnnme = getFunctionId(p);
if( p && p->argc > 1 ){
@@ -147,6 +150,10 @@ OPTwrapper(Client cntxt, MalBlkPtr mb, M
for (i = 0; codes[i].nme != NULL; i++) {
if (strcmp(codes[i].nme, id) == 0) {
msg = (str)(*codes[i].fcn)(cntxt, mb, stk, p);
+ if (mb->errors) {
+ msg = mb->errors;
+ mb->errors = NULL;
+ }
clk = GDKusec() - clk;
MT_lock_set(&codeslock);
codes[i].timing += clk;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]