Changeset: bc51263512d7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/bc51263512d7 Modified Files: sql/server/rel_select.c Branch: odbc_loader Log Message:
merged with default diffs (truncated from 322 to 300 lines): diff --git a/clients/examples/C/streamcat.c b/clients/examples/C/streamcat.c --- a/clients/examples/C/streamcat.c +++ b/clients/examples/C/streamcat.c @@ -624,11 +624,10 @@ int cmd_bstream(char *argv[]) } } - mnstr_destroy(bs); if (additional) { mnstr_printf(s, "%s", additional); } - mnstr_close(s); + close_stream(bs); /* this also closes and destroys s */ return 0; } diff --git a/clients/examples/C/testcondvar.c b/clients/examples/C/testcondvar.c --- a/clients/examples/C/testcondvar.c +++ b/clients/examples/C/testcondvar.c @@ -12,7 +12,6 @@ #include "monetdb_config.h" #include "gdk.h" -#include "gdk_system.h" #define NN (3) diff --git a/common/utils/matomic.h b/common/utils/matomic.h --- a/common/utils/matomic.h +++ b/common/utils/matomic.h @@ -87,7 +87,7 @@ typedef unsigned long ATOMIC_BASE_TYPE; #error "we need a 64 bit atomic type" #endif -#else +#else /* not C++ */ #include <stdatomic.h> diff --git a/common/utils/mstring.h b/common/utils/mstring.h --- a/common/utils/mstring.h +++ b/common/utils/mstring.h @@ -24,7 +24,7 @@ #endif #if defined(__has_attribute) -#if ! __has_attribute(access) +#if ! __has_attribute(__access__) #define __access__(...) #endif #else @@ -42,30 +42,7 @@ strcpy_len(char *restrict dst, const cha if ((dst[i] = src[i]) == 0) return i; } - /* for correctness, the decrement isn't needed (just assigning 0 - * to dst[n-1] would be sufficient), but to work around a too - * strict GNU C compiler, we do need it */ - dst[--n] = 0; -/* in some versions of GCC (at least gcc (Ubuntu 7.5.0-3ubuntu1~18.04) - * 7.5.0), the error just can't be turned off when using - * --enable-strict, so we just use the (more) expensive way of getting the - * right answer (rescan the whole string) */ -#if !defined(__GNUC__) || __GNUC__ > 7 || (__GNUC__ == 7 && __GNUC_MINOR__ > 5) -/* This code is correct, but GCC gives a warning in certain - * conditions, so we disable the warning temporarily. - * The warning happens e.g. in - * strcpy_len(buf, "fixed string", sizeof(buf)) - * where buf is larger than the string. In that case we never get here - * since return is executed in the loop above, but the compiler - * complains anyway about reading out-of-bounds. - * For GCC we use _Pragma to disable the warning (and hence error). - * Since other compilers may warn (and hence error out) on - * unrecognized pragmas, we use some preprocessor trickery. */ -GCC_Pragma("GCC diagnostic push") -GCC_Pragma("GCC diagnostic ignored \"-Warray-bounds\"") - return n + strlen(src + n); -GCC_Pragma("GCC diagnostic pop") -#endif + dst[n - 1] = 0; } return strlen(src); } @@ -73,6 +50,7 @@ GCC_Pragma("GCC diagnostic pop") /* copy the NULL terminated list of src strings with a maximum of n * bytes to dst; return the combined length of the src strings */ __attribute__((__access__(write_only, 1, 2))) +__attribute__((__sentinel__)) static inline size_t strconcat_len(char *restrict dst, size_t n, const char *restrict src, ...) { diff --git a/gdk/gdk_calc_private.h b/gdk/gdk_calc_private.h --- a/gdk/gdk_calc_private.h +++ b/gdk/gdk_calc_private.h @@ -33,8 +33,6 @@ #define GT(a, b) ((bit) ((a) > (b))) -#include "gdk_cand.h" - #ifdef __has_builtin #if __has_builtin(__builtin_add_overflow) #define OP_WITH_CHECK(lft, rgt, dst, op, max, on_overflow) \ diff --git a/gdk/gdk_cand.c b/gdk/gdk_cand.c --- a/gdk/gdk_cand.c +++ b/gdk/gdk_cand.c @@ -13,7 +13,6 @@ #include "monetdb_config.h" #include "gdk.h" #include "gdk_private.h" -#include "gdk_cand.h" bool BATiscand(BAT *b) diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c --- a/gdk/gdk_group.c +++ b/gdk/gdk_group.c @@ -13,7 +13,6 @@ #include "monetdb_config.h" #include "gdk.h" #include "gdk_private.h" -#include "gdk_cand.h" /* how much to extend the extent and histo bats when we run out of space */ #define GROUPBATINCR 8192 diff --git a/gdk/gdk_posix.h b/gdk/gdk_posix.h --- a/gdk/gdk_posix.h +++ b/gdk/gdk_posix.h @@ -30,8 +30,6 @@ #endif #endif -#include "gdk_system.h" /* gdk_export */ - #ifdef NATIVE_WIN32 #include <io.h> #include <direct.h> diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -135,9 +135,13 @@ gdk_return GDKextendf(int fd, size_t siz int GDKfdlocate(int farmid, const char *nme, const char *mode, const char *ext) __attribute__((__visibility__("hidden"))); FILE *GDKfilelocate(int farmid, const char *nme, const char *mode, const char *ext) - __attribute__((__visibility__("hidden"))); + __attribute__((__visibility__("hidden"))) + __attribute__((__malloc__)) + __attribute__((__malloc__(fclose, 1))); FILE *GDKfileopen(int farmid, const char *dir, const char *name, const char *extension, const char *mode) - __attribute__((__visibility__("hidden"))); + __attribute__((__visibility__("hidden"))) + __attribute__((__malloc__)) + __attribute__((__malloc__(fclose, 1))); char *GDKload(int farmid, const char *nme, const char *ext, size_t size, size_t *maxsize, storage_t mode) __attribute__((__visibility__("hidden"))); gdk_return GDKmove(int farmid, const char *dir1, const char *nme1, const char *ext1, const char *dir2, const char *nme2, const char *ext2, bool report) @@ -264,6 +268,7 @@ BAT *virtualize(BAT *bn) /* calculate the integer 2 logarithm (i.e. position of highest set * bit) of the argument (with a slight twist: 0 gives 0, 1 gives 1, * 0x8 to 0xF give 4, etc.) */ +__attribute__((__const__)) static inline unsigned ilog2(BUN x) { diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c --- a/gdk/gdk_string.c +++ b/gdk/gdk_string.c @@ -13,7 +13,6 @@ #include "monetdb_config.h" #include "gdk.h" #include "gdk_private.h" -#include "gdk_cand.h" /* String Atom Implementation * diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c --- a/gdk/gdk_tracer.c +++ b/gdk/gdk_tracer.c @@ -12,7 +12,6 @@ #include "monetdb_config.h" #include "gdk.h" -#include "gdk_tracer.h" #include "gdk_private.h" #include "mutils.h" diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c --- a/geom/monetdb5/geom.c +++ b/geom/monetdb5/geom.c @@ -18,7 +18,6 @@ #include "geom.h" #include "geod.h" #include "geom_atoms.h" -#include "gdk_logger.h" #include "mal_exception.h" mbr mbrNIL = {0}; // will be initialized properly by geom prelude diff --git a/monetdb5/extras/rapi/rapi.c b/monetdb5/extras/rapi/rapi.c --- a/monetdb5/extras/rapi/rapi.c +++ b/monetdb5/extras/rapi/rapi.c @@ -18,7 +18,6 @@ #include "mal.h" #include "mal_stack.h" #include "mal_linker.h" -#include "gdk_utils.h" #include "gdk.h" #include "sql_catalog.h" #include "sql_execute.h" 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 @@ -45,7 +45,6 @@ #include "mal_instruction.h" #include "mal_resource.h" #include "mal_authorize.h" -#include "gdk_cand.h" static inline void BBPnreclaim(int nargs, ...) diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -4163,6 +4163,8 @@ rel_next_value_for( mvc *sql, symbol *se sql_subtype t; sql_subfunc *f; + if (!sname) + sname = "sys"; if (!stack_find_rel_view(sql, seqname)) { if (!(seq = find_sequence_on_scope(sql, sname, seqname, "NEXT VALUE FOR"))) return NULL; @@ -4172,8 +4174,8 @@ rel_next_value_for( mvc *sql, symbol *se sql_find_subtype(&t, "varchar", 0, 0); f = sql_bind_func(sql, "sys", "next_value_for", &t, &t, F_FUNC, true, true); assert(f); - /* sequence found in the stack. use session's schema? */ - return exp_binop(sql->sa, exp_atom_str(sql->sa, seq && seq->s ? seq->s->base.name : "sys", &t), exp_atom_str(sql->sa, seqname, &t), f); + /* sequence found in the stack, ie just created. use given schema? */ + return exp_binop(sql->sa, exp_atom_str(sql->sa, seq && seq->s ? seq->s->base.name : sname, &t), exp_atom_str(sql->sa, seqname, &t), f); } /* some users like to use aliases already in the groupby */ diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c --- a/sql/storage/bat/bat_logger.c +++ b/sql/storage/bat/bat_logger.c @@ -113,6 +113,7 @@ log_temp_descriptor(log_bid b) } #if defined CATALOG_JAN2022 || defined CATALOG_SEP2022 +/* cannot use attribute((sentinel)) since sentinel is not a pointer */ static gdk_return tabins(logger *lg, ...) { diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -14,8 +14,6 @@ #include "bat_storage.h" #include "bat_utils.h" #include "sql_string.h" -#include "gdk_atoms.h" -#include "gdk_atoms.h" #include "matomic.h" #define FATAL_MERGE_FAILURE "Out Of Memory during critical merge operation: %s" diff --git a/sql/storage/objlist.c b/sql/storage/objlist.c --- a/sql/storage/objlist.c +++ b/sql/storage/objlist.c @@ -14,8 +14,6 @@ #include "sql_catalog.h" #include "sql_storage.h" -#include "gdk_atoms.h" - static inline int node_key( node *n ) { diff --git a/sql/test/BugTracker-2024/Tests/7607-alter-add-serial.test b/sql/test/BugTracker-2024/Tests/7607-alter-add-serial.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2024/Tests/7607-alter-add-serial.test @@ -0,0 +1,20 @@ +statement ok +create schema s7607 + +statement ok +set schema s7607 + +statement ok +create table t(a int) + +statement ok +alter table t add column b int + +statement ok +alter table t add column c int auto_increment + +statement ok +alter table t add column d serial; + _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org