Changeset: 939f5280017e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/939f5280017e Modified Files: clients/Tests/exports.stable.out gdk/gdk.h monetdb5/modules/mal/txtsim.c sql/backends/monet5/rel_bin.c sql/backends/monet5/rel_physical.c sql/backends/monet5/rel_pphash.c sql/backends/monet5/sql_statement.c sql/backends/monet5/vaults/monetdb/monetdb.c sql/include/sql_catalog.h sql/server/rel_dump.c sql/server/rel_exp.c sql/server/rel_exp.h sql/server/rel_optimize_others.c sql/server/rel_optimize_proj.c sql/server/rel_optimize_sel.c sql/server/rel_optimizer.c sql/server/rel_propagate.c sql/server/rel_psm.c sql/server/rel_rel.c sql/server/rel_rewriter.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_statistics.c sql/server/rel_unnest.c sql/server/rel_updates.c sql/server/sql_parser.y sql/server/sql_partition.c sql/server/sqlparse.c sql/test/emptydb/Tests/check.stable.out.int128 Branch: nested Log Message:
merged with default diffs (truncated from 3871 to 300 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -862,3 +862,4 @@ b4c2936c46f28ad6b3e59ed5a1a844726d521994 bc5735402f969151c941c100a7552769c0e89a9a Dec2025_9 bc5735402f969151c941c100a7552769c0e89a9a Dec2025_SP4_release 7fc4b6dba998768109bbc40409a6128992eef08e Dec2025_11 +7fc4b6dba998768109bbc40409a6128992eef08e Dec2025_SP5_release diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,33 @@ # ChangeLog file for devel # This file is updated with Maddlog +* Thu Nov 26 2026 Martin van Dinther <[email protected]> +- Added support for IF NOT EXISTS syntax in following CREATE statements: + CREATE AGGREGATE FUNCTION + CREATE FILTER FUNCTION + CREATE FUNCTION + CREATE PROCEDURE + CREATE TEMPORARY VIEW + CREATE TRIGGER + CREATE VIEW + CREATE WINDOW FUNCTION + The IF NOT EXISTS clause is optional but when used must be placed before + the object name, so: + CREATE AGGREGATE FUNCTION IF NOT EXISTS name ... + CREATE FILTER FUNCTION IF NOT EXISTS name ... + CREATE FUNCTION IF NOT EXISTS name ... + CREATE PROCEDURE IF NOT EXISTS name ... + CREATE TEMPORARY VIEW IF NOT EXISTS name ... + CREATE TRIGGER IF NOT EXISTS name ... + CREATE VIEW IF NOT EXISTS name ... + CREATE WINDOW FUNCTION IF NOT EXISTS name ... + When IF NOT EXIST is used in these CREATE statements, it will no longer + report an error when the object with same name or function signature + already exists. This can be useful in scripts, where you want to + create the object only if is does not yet exists. + Note: It is not allowed to combine both CREATE OR REPLACE and IF NOT EXISTS + in these CREATE statements. + * Wed Nov 18 2026 Martin van Dinther <[email protected]> - Queries to a proto_loader('odbc:...') function with a limit-clause will now push the limit value down to the ODBC driver via ODBC call 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 @@ -463,6 +463,11 @@ void VIEWbounds(BAT *b, BAT *view, BUN l BAT *VIEWcreate(oid seq, BAT *b, BUN l, BUN h); size_t _MT_npages; size_t _MT_pagesize; +bool add_int128_overflow(int128_t a, int128_t b, int128_t *d); +bool add_int16_overflow(int16_t a, int16_t b, int16_t *d); +bool add_int32_overflow(int32_t a, int32_t b, int32_t *d); +bool add_int64_overflow(int64_t a, int64_t b, int64_t *d); +bool add_int8_overflow(int8_t a, int8_t b, int8_t *d); char *asctime_r(const struct tm *restrict, char *restrict); double bat_guess_uniques(BAT *b, BATiter *bi, struct canditer *bci); ssize_t bitFromStr(allocator *ma, const char *src, size_t *len, bit **dst, bool external); @@ -592,6 +597,11 @@ const char *mo_find_option(opt *set, int void mo_free_options(opt *set, int setlen); void mo_print_options(opt *set, int setlen); int mo_system_config(opt **Set, int setlen); +bool mul_int128_overflow(int128_t a, int128_t b, int128_t *d); +bool mul_int16_overflow(int16_t a, int16_t b, int16_t *d); +bool mul_int32_overflow(int32_t a, int32_t b, int32_t *d); +bool mul_int64_overflow(int64_t a, int64_t b, int64_t *d); +bool mul_int8_overflow(int8_t a, int8_t b, int8_t *d); const oid oid_nil; ssize_t ptrFromStr(allocator *ma, const char *src, size_t *len, ptr **dst, bool external); ssize_t ptrToStr(allocator *ma, char **dst, size_t *len, const ptr *src, bool external); @@ -606,6 +616,11 @@ ssize_t sql_timestamp_fromstr(allocator ssize_t strFromStr(allocator *ma, const char *restrict src, size_t *restrict len, char **restrict dst, bool external); const char str_nil[2]; int strerror_r(int errnum, char *buf, size_t buflen); +bool sub_int128_overflow(int128_t a, int128_t b, int128_t *d); +bool sub_int16_overflow(int16_t a, int16_t b, int16_t *d); +bool sub_int32_overflow(int32_t a, int32_t b, int32_t *d); +bool sub_int64_overflow(int64_t a, int64_t b, int64_t *d); +bool sub_int8_overflow(int8_t a, int8_t b, int8_t *d); timestamp timestamp_add_month(timestamp t, int m); timestamp timestamp_add_usec(timestamp t, lng usec); timestamp timestamp_create(date dt, daytime tm); diff --git a/common/stream/fwf.c b/common/stream/fwf.c --- a/common/stream/fwf.c +++ b/common/stream/fwf.c @@ -74,18 +74,20 @@ stream_fwf_read(stream *restrict s, void for (field_idx = 0; field_idx < fsd->num_fields; field_idx++) { char *val_start, *val_end; - val_start = fsd->in_buf + in_buf_pos; - in_buf_pos += fsd->widths[field_idx]; - val_end = fsd->in_buf + in_buf_pos - 1; - while (*val_start == fsd->filler) - val_start++; - while (*val_end == fsd->filler) - val_end--; - while (val_start <= val_end) { - if (*val_start == STREAM_FWF_FIELD_SEP) { - fsd->out_buf[out_buf_pos++] = STREAM_FWF_ESCAPE; + if (fsd->widths[field_idx] > 0) { + val_start = fsd->in_buf + in_buf_pos; + in_buf_pos += fsd->widths[field_idx]; + val_end = fsd->in_buf + in_buf_pos - 1; + while (*val_start == fsd->filler) + val_start++; + while (*val_end == fsd->filler) + val_end--; + while (val_start <= val_end) { + if (*val_start == STREAM_FWF_FIELD_SEP) { + fsd->out_buf[out_buf_pos++] = STREAM_FWF_ESCAPE; + } + fsd->out_buf[out_buf_pos++] = *val_start++; } - fsd->out_buf[out_buf_pos++] = *val_start++; } fsd->out_buf[out_buf_pos++] = STREAM_FWF_FIELD_SEP; } @@ -161,7 +163,7 @@ stream_fwf_create(stream *restrict s, si mnstr_set_open_error(STREAM_FWF_NAME, errno, NULL); return NULL; } - fsd->out_buf = malloc(fsd->line_len * 3); + fsd->out_buf = malloc(fsd->line_len * 2 + num_fields + 1); if (fsd->out_buf == NULL) { free(fsd->in_buf); free(fsd); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -1967,8 +1967,8 @@ gdk_export size_t escapedStr(char *restr #define GDK_lng_max ((lng) INT64_MAX) #define GDK_lng_min ((lng) INT64_MIN+1) #ifdef HAVE_HGE -#define GDK_hge_max ((((hge) 1) << 126) - 1 + (((hge) 1) << 126)) -#define GDK_hge_min (-GDK_hge_max) +#define GDK_hge_max ((hge) INT128_MAX) +#define GDK_hge_min ((hge) INT128_MIN+1) #endif #define GDK_flt_max ((flt) FLT_MAX) #define GDK_flt_min ((flt) -FLT_MAX) @@ -2281,6 +2281,28 @@ VarHeapVal(const void *b, BUN p, uint32_ } } +gdk_export bool add_int8_overflow(int8_t a, int8_t b, int8_t *d); +gdk_export bool add_int16_overflow(int16_t a, int16_t b, int16_t *d); +gdk_export bool add_int32_overflow(int32_t a, int32_t b, int32_t *d); +gdk_export bool add_int64_overflow(int64_t a, int64_t b, int64_t *d); +#ifdef HAVE_INT128_T +gdk_export bool add_int128_overflow(int128_t a, int128_t b, int128_t *d); +#endif +gdk_export bool sub_int8_overflow(int8_t a, int8_t b, int8_t *d); +gdk_export bool sub_int16_overflow(int16_t a, int16_t b, int16_t *d); +gdk_export bool sub_int32_overflow(int32_t a, int32_t b, int32_t *d); +gdk_export bool sub_int64_overflow(int64_t a, int64_t b, int64_t *d); +#ifdef HAVE_INT128_T +gdk_export bool sub_int128_overflow(int128_t a, int128_t b, int128_t *d); +#endif +gdk_export bool mul_int8_overflow(int8_t a, int8_t b, int8_t *d); +gdk_export bool mul_int16_overflow(int16_t a, int16_t b, int16_t *d); +gdk_export bool mul_int32_overflow(int32_t a, int32_t b, int32_t *d); +gdk_export bool mul_int64_overflow(int64_t a, int64_t b, int64_t *d); +#ifdef HAVE_INT128_T +gdk_export bool mul_int128_overflow(int128_t a, int128_t b, int128_t *d); +#endif + /* BAT iterator, also protects use of BAT heaps with reference counts. * * A BAT iterator has to be used with caution, but it does have to be diff --git a/gdk/gdk_calc_addsub.c b/gdk/gdk_calc_addsub.c --- a/gdk/gdk_calc_addsub.c +++ b/gdk/gdk_calc_addsub.c @@ -13,6 +13,80 @@ #include "gdk_private.h" #include "gdk_calc_private.h" +bool +add_int8_overflow(int8_t a, int8_t b, int8_t *d) +{ + ADDI_WITH_CHECK(a, b, int8_t, *d, INT8_MAX, return true); + return false; +} + +bool +add_int16_overflow(int16_t a, int16_t b, int16_t *d) +{ + ADDI_WITH_CHECK(a, b, int16_t, *d, INT16_MAX, return true); + return false; +} + +bool +add_int32_overflow(int32_t a, int32_t b, int32_t *d) +{ + ADDI_WITH_CHECK(a, b, int32_t, *d, INT32_MAX, return true); + return false; +} + +bool +add_int64_overflow(int64_t a, int64_t b, int64_t *d) +{ + ADDI_WITH_CHECK(a, b, int64_t, *d, INT64_MAX, return true); + return false; +} + +#ifdef HAVE_INT128_T +bool +add_int128_overflow(int128_t a, int128_t b, int128_t *d) +{ + ADDI_WITH_CHECK(a, b, int128_t, *d, INT128_MAX, return true); + return false; +} +#endif + +bool +sub_int8_overflow(int8_t a, int8_t b, int8_t *d) +{ + SUBI_WITH_CHECK(a, b, int8_t, *d, INT8_MAX, return true); + return false; +} + +bool +sub_int16_overflow(int16_t a, int16_t b, int16_t *d) +{ + SUBI_WITH_CHECK(a, b, int16_t, *d, INT16_MAX, return true); + return false; +} + +bool +sub_int32_overflow(int32_t a, int32_t b, int32_t *d) +{ + SUBI_WITH_CHECK(a, b, int32_t, *d, INT32_MAX, return true); + return false; +} + +bool +sub_int64_overflow(int64_t a, int64_t b, int64_t *d) +{ + SUBI_WITH_CHECK(a, b, int64_t, *d, INT64_MAX, return true); + return false; +} + +#ifdef HAVE_INT128_T +bool +sub_int128_overflow(int128_t a, int128_t b, int128_t *d) +{ + SUBI_WITH_CHECK(a, b, int128_t, *d, INT128_MAX, return true); + return false; +} +#endif + /* ---------------------------------------------------------------------- */ /* addition (any numeric type) */ diff --git a/gdk/gdk_calc_mul.c b/gdk/gdk_calc_mul.c --- a/gdk/gdk_calc_mul.c +++ b/gdk/gdk_calc_mul.c @@ -13,6 +13,43 @@ #include "gdk_private.h" #include "gdk_calc_private.h" +bool +mul_int8_overflow(int8_t a, int8_t b, int8_t *d) +{ + MULI4_WITH_CHECK(a, b, int8_t, *d, INT8_MAX, int16_t, return true); + return false; +} + +bool +mul_int16_overflow(int16_t a, int16_t b, int16_t *d) +{ + MULI4_WITH_CHECK(a, b, int16_t, *d, INT16_MAX, int32_t, return true); + return false; +} + +bool +mul_int32_overflow(int32_t a, int32_t b, int32_t *d) +{ + MULI4_WITH_CHECK(a, b, int32_t, *d, INT32_MAX, int64_t, return true); + return false; +} + +bool +mul_int64_overflow(int64_t a, int64_t b, int64_t *d) +{ + LNGMUL_CHECK(a, b, *d, INT64_MAX, return true); + return false; +} + +#ifdef HAVE_INT128_T +bool +mul_int128_overflow(int128_t a, int128_t b, int128_t *d) +{ + HGEMUL_CHECK(a, b, *d, INT128_MAX, return true); + return false; +} +#endif + /* ---------------------------------------------------------------------- */ _______________________________________________ checkin-list mailing list -- [email protected] To unsubscribe send an email to [email protected]
