Changeset: 56c77edf8891 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/56c77edf8891 Modified Files: sql/backends/monet5/sql.c Branch: Aug2024 Log Message:
get the SQL expression in the CHECK constraint diffs (35 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 @@ -5487,7 +5487,7 @@ SQLcheck(Client cntxt, MalBlkPtr mb, Mal str msg = NULL; str *r = getArgReference_str(stk, pci, 0); const char *sname = *getArgReference_str(stk, pci, 1); - const char *cname = *getArgReference_str(stk, pci, 2); + const char *kname = *getArgReference_str(stk, pci, 2); if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL) return msg; @@ -5496,14 +5496,19 @@ SQLcheck(Client cntxt, MalBlkPtr mb, Mal (void)sname; sql_schema *s = mvc_bind_schema(m, sname); if (s) { - sql_key *k = mvc_bind_key(m, s, cname); - if (k->check) { + sql_key *k = mvc_bind_key(m, s, kname); + 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); - *r = GDKstrdup(exp2sql(m, exp)); + if (!(*r = GDKstrdup(exp->comment))) + throw(SQL, "SQLcheck", SQLSTATE(HY013) MAL_MALLOC_FAIL); + // *r = GDKstrdup(exp2sql(m, exp)); + return MAL_SUCCEED; } } + if (!(*r = GDKstrdup(str_nil))) + throw(SQL, "SQLcheck", SQLSTATE(HY013) MAL_MALLOC_FAIL); return MAL_SUCCEED; } _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org