Changeset: 4059e188c918 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4059e188c918
Modified Files:
        sql/backends/monet5/sql_gencode.c
Branch: sqlfuncfix
Log Message:

Another corner case handling. While loading a SQL MAL function after a server 
restart, check the side-effect definitions match between SQL catalog and MAL 
definition


diffs (29 lines):

diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -1108,6 +1108,11 @@ backend_create_mal_func(mvc *m, sql_func
                return 0;
        lock_function(m->store, f->base.id);
        if (!f->instantiated) {
+               char *F = NULL, *fn = NULL;
+               bit side_effect = f->side_effect;
+
+               FUNC_TYPE_STR(f->type, F, fn)
+               (void) F;
                if (strlen(f->mod) >= IDLENGTH) {
                        (void) sql_error(m, 01, SQLSTATE(42000) "MAL module 
name '%s' too large for the backend", f->mod);
                        unlock_function(m->store, f->base.id);
@@ -1123,6 +1128,13 @@ backend_create_mal_func(mvc *m, sql_func
                        unlock_function(m->store, f->base.id);
                        return -1;
                }
+               if (side_effect != f->side_effect) {
+                       (void) sql_error(m, 02, SQLSTATE(42000) "Side-effect 
value from the SQL %s %s.%s doesn't match the MAL definition %s.%s\n"
+                                                        "Either re-create the 
%s, or fix the MAL definition and restart the database", fn, f->s->base.name, 
f->base.name, f->mod, f->imp, fn);
+                       _DELETE(f->imp);
+                       unlock_function(m->store, f->base.id);
+                       return -1;
+               }
                f->instantiated = TRUE; /* make sure 'instantiated' gets set 
after 'imp' */
        }
        unlock_function(m->store, f->base.id);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to