Changeset: eeb8773633cb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/eeb8773633cb
Modified Files:
        sql/backends/monet5/sql.c
Branch: Mar2025
Log Message:

set the proper stack pointer for the call to SQLcheck


diffs (43 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -5506,18 +5506,38 @@ SQLcheck(Client cntxt, MalBlkPtr mb, Mal
        sql_schema *s = mvc_bind_schema(m, sname);
        if (s) {
                sql_key *k = mvc_bind_key(m, s, kname);
+               uintptr_t sp = m->sp;
+#ifdef __has_builtin
+#if __has_builtin(__builtin_frame_address)
+               m->sp = (uintptr_t) __builtin_frame_address(0);
+#define BUILTIN_USED
+#endif
+#endif
+#ifndef BUILTIN_USED
+               m->sp = (uintptr_t)(&m);
+#endif
+#undef BUILTIN_USED
                if (k && k->check) {
                        int pos = 0;
                        sql_rel *rel = rel_basetable(m, k->t, k->t->base.name);
-                       sql_exp *exp = exp_read(m, rel, NULL, NULL, 
sa_strdup(m->sa, k->check), &pos, 0);
+                       sql_exp *exp = NULL;
+                       if (rel) {
+                               rel_base_use_all(m, rel);
+                               exp = exp_read(m, rel, NULL, NULL, 
sa_strdup(m->sa, k->check), &pos, 0);
+                       }
+                       assert(exp);
+                       if (!exp)
+                               throw(SQL, "SQLcheck", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
                        if (exp->comment)
                                *r = GDKstrdup(exp->comment);
                        else
                                *r = GDKstrdup(exp2sql(m, exp));
                        if (*r == NULL)
                                throw(SQL, "SQLcheck", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
+                       m->sp = sp;
                        return MAL_SUCCEED;
                }
+               m->sp = sp;
        }
        if (!(*r = GDKstrdup(str_nil)))
                throw(SQL, "SQLcheck", SQLSTATE(HY013) MAL_MALLOC_FAIL);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to