Changeset: de30c37942cd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/de30c37942cd
Modified Files:
        sql/server/rel_select.c
Branch: clean_parser
Log Message:

merged


diffs (267 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
@@ -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);
 }
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_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
@@ -4116,6 +4116,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;
@@ -4125,8 +4127,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_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;
+
+statement ok
+create table tb(a int, b int auto_increment)
diff --git a/sql/test/BugTracker-2024/Tests/All 
b/sql/test/BugTracker-2024/Tests/All
--- a/sql/test/BugTracker-2024/Tests/All
+++ b/sql/test/BugTracker-2024/Tests/All
@@ -99,3 +99,4 @@ KNOWNFAIL?7598-foreign_key_match_options
 KNOWNFAIL?7598-foreign_key_match_options_dump
 7602-copy-into-multiple-files
 7603-copy-into-3files-crash
+7607-alter-add-serial.test
diff --git a/unistd.h.in b/unistd.h.in
--- a/unistd.h.in
+++ b/unistd.h.in
@@ -12,7 +12,7 @@
 
 #ifndef UNISTD_H
 #define UNISTD_H
-#include "io.h"
+#include <io.h>
 #ifndef __cplusplus
 #define open _open
 #define read _read
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to