Changeset: 3447752d2602 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/3447752d2602 Modified Files: sql/server/rel_optimizer.c Branch: properties Log Message:
Merged with default diffs (truncated from 473 to 300 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -906,7 +906,7 @@ const char *comment_onRef; const char *commitRef; str compileString(Symbol *fcn, Client c, str s); const char *compressRef; -char *concatErrors(char *err1, const char *err2) __attribute__((__nonnull__(1, 2))) __attribute__((__returns_nonnull__)); +char *concatErrors(char *err1, const char *err2) __attribute__((__nonnull__(1))) __attribute__((__nonnull__(2))) __attribute__((__returns_nonnull__)); const char *connectRef; const char *contextRef; str convertConstant(malType type, ValPtr vr); diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -1080,7 +1080,7 @@ static char nomem[] = "Memory allocation static void mapi_clrError(Mapi mid) - __attribute__((__nonnull__)); + __attribute__((__nonnull__(1))); static void mapi_clrError(Mapi mid) @@ -1095,7 +1095,7 @@ mapi_clrError(Mapi mid) static MapiMsg mapi_setError(Mapi mid, const char *msg, const char *action, MapiMsg error) - __attribute__((__nonnull__(2, 3))); + __attribute__((__nonnull__(2))) __attribute__((__nonnull__(3))); static MapiMsg mapi_setError(Mapi mid, const char *msg, const char *action, MapiMsg error) diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h --- a/gdk/gdk_system.h +++ b/gdk/gdk_system.h @@ -14,7 +14,8 @@ * specific attributes that we use are known */ #ifndef __has_attribute #ifndef __GNUC__ -#define __has_attribute(attr) 0 +/* we can define __has_attribute as 1 since we define __attribute__ as empty */ +#define __has_attribute(attr) 1 #ifndef __attribute__ #define __attribute__(attr) /* empty */ #endif @@ -23,50 +24,60 @@ * attributes that we use are known */ #define __has_attribute__alloc_size__ 1 #define __has_attribute__cold__ 1 +#define __has_attribute__const__ 1 +#define __has_attribute__constructor__ 1 +#define __has_attribute__designated_init__ 0 #define __has_attribute__format__ 1 -#define __has_attribute__designated_init__ 0 #define __has_attribute__malloc__ 1 +#define __has_attribute__nonnull__ 1 #define __has_attribute__nonstring__ 0 -#define __has_attribute__noreturn__ 1 -#define __has_attribute__pure__ 0 +#define __has_attribute__pure__ 1 #define __has_attribute__returns_nonnull__ 0 #define __has_attribute__visibility__ 1 #define __has_attribute__warn_unused_result__ 1 #define __has_attribute(attr) __has_attribute##attr #endif #endif -#if !__has_attribute(__warn_unused_result__) -#define __warn_unused_result__ -#endif -#if !__has_attribute(__malloc__) -#define __malloc__ -#endif #if !__has_attribute(__alloc_size__) #define __alloc_size__(a) #endif +#if !__has_attribute(__cold__) +#define __cold__ +#endif +#if !__has_attribute(__const__) +#define __const__ +#endif +#if !__has_attribute(__constructor__) +#define __constructor__ +#endif +#if !__has_attribute(__designated_init__) +#define __designated_init__ +#endif #if !__has_attribute(__format__) #define __format__(a,b,c) #endif +#if !__has_attribute(__malloc__) +#define __malloc__ +#endif +#if !__has_attribute(__nonnull__) +#define __nonnull__(a) +#endif #if !__has_attribute(__nonstring__) #define __nonstring__ #endif -#if !__has_attribute(__noreturn__) -#define __noreturn__ -#endif #if !__has_attribute(__pure__) #define __pure__ #endif -#if !__has_attribute(__designated_init__) -#define __designated_init__ +#if !__has_attribute(__returns_nonnull__) +#define __returns_nonnull__ #endif -/* these are used in some *private.h files */ #if !__has_attribute(__visibility__) #define __visibility__(a) #elif defined(__CYGWIN__) #define __visibility__(a) #endif -#if !__has_attribute(__cold__) -#define __cold__ +#if !__has_attribute(__warn_unused_result__) +#define __warn_unused_result__ #endif /* also see gdk.h for these */ diff --git a/monetdb5/mal/mal_exception.h b/monetdb5/mal/mal_exception.h --- a/monetdb5/mal/mal_exception.h +++ b/monetdb5/mal/mal_exception.h @@ -51,7 +51,7 @@ mal_export str createMalException(MalBlk __attribute__((__format__(__printf__, 4, 5))) __attribute__((__returns_nonnull__)); mal_export char *concatErrors(char *err1, const char *err2) - __attribute__((__nonnull__(1, 2))) + __attribute__((__nonnull__(1))) __attribute__((__nonnull__(2))) __attribute__((__returns_nonnull__)); mal_export bool isExceptionVariable(const char *nme); diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c --- a/monetdb5/modules/mal/pcre.c +++ b/monetdb5/modules/mal/pcre.c @@ -1572,7 +1572,7 @@ BATPCRElike_imp(Client cntxt, MalBlkPtr str msg = MAL_SUCCEED; BAT *b = NULL, *pbn = NULL, *bn = NULL; char *ppat = NULL; - const char *input; + const char *input = NULL; bool use_re = false, use_strcmp = false, empty = false, isensitive = (bool) *isens, anti = (bool) *not, has_nil = false, input_is_a_bat = isaBatType(getArgType(mb, pci, 1)), pattern_is_a_bat = isaBatType(getArgType(mb, pci, 2)); bat *r = getArgReference_bat(stk, pci, 0); diff --git a/monetdb_config.h.in b/monetdb_config.h.in --- a/monetdb_config.h.in +++ b/monetdb_config.h.in @@ -463,7 +463,7 @@ gmtime_r(const time_t *restrict timep, s #endif #else #define LIB_STARTUP_FUNC(f) \ - static void f(void) __attribute__((constructor)); \ + static void f(void) __attribute__((__constructor__)); \ static void f(void) #endif diff --git a/sql/ChangeLog.Jan2022 b/sql/ChangeLog.Jan2022 --- a/sql/ChangeLog.Jan2022 +++ b/sql/ChangeLog.Jan2022 @@ -1,3 +1,10 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Mon Jan 24 2022 svetlin <svetlin.stali...@monetdbsolutions.com> +- [This feature was already released in Jan2022 (11.43), but the ChangeLog was missing] + Added SQL procedures sys.vacuum(sname string, tname string, cname string), + sys.vacuum(sname string, tname string, cname string, interval int), + sys.stop_vacuum(sname string, tname string, cname string). + These can be used to vacuum string columns. + diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -3060,7 +3060,7 @@ exp_simplify_math( mvc *sql, sql_exp *e, static inline sql_rel * rel_simplify_math(visitor *v, sql_rel *rel) { - if ((is_simple_project(rel->op) || is_groupby(rel->op) || (rel->op == op_ddl && rel->flag == ddl_psm)) && rel->exps) { + if ((is_simple_project(rel->op) || (rel->op == op_ddl && rel->flag == ddl_psm)) && rel->exps) { int needed = 0, ochanges = 0; for (node *n = rel->exps->h; n && !needed; n = n->next) { @@ -3747,30 +3747,25 @@ exps_merge_select_rse( mvc *sql, list *l return nexps; } -static sql_exp * -rel_merge_project_rse(visitor *v, sql_rel *rel, sql_exp *e, int depth) -{ - (void) depth; - +static inline sql_exp * +rel_merge_project_rse(visitor *v, sql_rel *rel, sql_exp *e) +{ if (is_simple_project(rel->op) && is_func(e->type) && e->l) { list *fexps = e->l; sql_subfunc *f = e->f; /* is and function */ - if (strcmp(f->func->base.name, "and") == 0 && list_length(fexps) == 2) { - sql_exp *l = list_fetch(fexps, 0); - sql_exp *r = list_fetch(fexps, 1); + if (!f->func->s && strcmp(f->func->base.name, "and") == 0 && list_length(fexps) == 2) { + sql_exp *l = list_fetch(fexps, 0), *r = list_fetch(fexps, 1); /* check merge into single between */ if (is_func(l->type) && is_func(r->type)) { - list *lfexps = l->l; - list *rfexps = r->l; - sql_subfunc *lff = l->f; - sql_subfunc *rff = r->f; + list *lfexps = l->l, *rfexps = r->l; + sql_subfunc *lff = l->f, *rff = r->f; if (((strcmp(lff->func->base.name, ">=") == 0 || strcmp(lff->func->base.name, ">") == 0) && list_length(lfexps) == 2) && - ((strcmp(rff->func->base.name, "<=") == 0 || strcmp(rff->func->base.name, "<") == 0) && list_length(rfexps) == 2)) { - sql_exp *le = list_fetch(lfexps,0), *lf = list_fetch(rfexps,0); + ((strcmp(rff->func->base.name, "<=") == 0 || strcmp(rff->func->base.name, "<") == 0) && list_length(rfexps) == 2)) { + sql_exp *le = list_fetch(lfexps, 0), *lf = list_fetch(rfexps, 0); int c_le = is_numeric_upcast(le), c_lf = is_numeric_upcast(lf); if (exp_equal(c_le?le->l:le, c_lf?lf->l:lf) == 0) { @@ -7478,79 +7473,9 @@ rel_select_order(visitor *v, sql_rel *re return rel; } -static inline sql_rel * -rel_simplify_like_select(visitor *v, sql_rel *rel) -{ - if (is_select(rel->op) && !list_empty(rel->exps)) { - for (node *n = rel->exps->h; n; n = n->next) { - sql_exp *e = n->data; - list *l = e->l; - list *r = e->r; - - if (e->type == e_cmp && e->flag == cmp_filter && strcmp(((sql_subfunc*)e->f)->func->base.name, "like") == 0 && list_length(l) == 1 && list_length(r) == 3) { - list *r = e->r; - sql_exp *fmt = r->h->data; - sql_exp *esc = r->h->next->data; - sql_exp *isen = r->h->next->next->data; - int rewrite = 0, isnull = 0; - - if (fmt->type == e_convert) - fmt = fmt->l; - /* check for simple like expression */ - if (exp_is_null(fmt)) { - isnull = 1; - } else if (is_atom(fmt->type)) { - atom *fa = NULL; - - if (fmt->l) - fa = fmt->l; - if (fa && fa->data.vtype == TYPE_str && !strchr(fa->data.val.sval, '%') && !strchr(fa->data.val.sval, '_')) - rewrite = 1; - } - if (rewrite && !isnull) { /* check escape flag */ - if (exp_is_null(esc)) { - isnull = 1; - } else { - atom *ea = esc->l; - - if (!is_atom(esc->type) || !ea) - rewrite = 0; - else if (ea->data.vtype != TYPE_str || strlen(ea->data.val.sval) != 0) - rewrite = 0; - } - } - if (rewrite && !isnull) { /* check insensitive flag */ - if (exp_is_null(isen)) { - isnull = 1; - } else { - atom *ia = isen->l; - - if (!is_atom(isen->type) || !ia) - rewrite = 0; - else if (ia->data.vtype != TYPE_bit || ia->data.val.btval == 1) - rewrite = 0; - } - } - if (isnull) { - rel->exps = list_append(sa_list(v->sql->sa), exp_null(v->sql->sa, sql_bind_localtype("bit"))); - v->changes++; - return rel; - } else if (rewrite) { /* rewrite to cmp_equal ! */ - list *l = e->l; - list *r = e->r; - n->data = exp_compare(v->sql->sa, l->h->data, r->h->data, is_anti(e) ? cmp_notequal : cmp_equal); - v->changes++; - } - } - } - } - return rel; -} - -static sql_exp * _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list