Changeset: cc4c301896ee for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cc4c301896ee
Added Files:
        
sql/test/BugTracker-2009/Tests/dumping_tables.SF-2776908--optimizers.options5
        
sql/test/BugTracker-2009/Tests/dumping_tables.SF-2776908--performance.options5
        
sql/test/BugTracker-2018/Tests/create_table_empty_column_name.Bug-6653.sql
        
sql/test/BugTracker-2018/Tests/create_table_empty_column_name.Bug-6653.stable.err
        
sql/test/BugTracker-2018/Tests/create_table_empty_column_name.Bug-6653.stable.out
Removed Files:
        
sql/test/BugTracker-2009/Tests/dumping_tables.SF-2776908--optimizers.dbinit5
        
sql/test/BugTracker-2009/Tests/dumping_tables.SF-2776908--performance.dbinit5
Modified Files:
        MonetDB.spec
        buildtools/ChangeLog-Archive
        clients/Tests/exports.stable.out
        clients/mapiclient/dump.c
        clients/mapilib/mapi.c
        common/stream/stream.c
        debian/changelog
        gdk/gdk.h
        gdk/gdk_aggr.c
        gdk/gdk_align.c
        gdk/gdk_atoms.c
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_delta.c
        gdk/gdk_firstn.c
        gdk/gdk_group.c
        gdk/gdk_hash.c
        gdk/gdk_hash.h
        gdk/gdk_heap.c
        gdk/gdk_logger.c
        gdk/gdk_logger.h
        gdk/gdk_orderidx.c
        gdk/gdk_private.h
        gdk/gdk_storage.c
        monetdb5/modules/kernel/logger.c
        monetdb5/tools/Tests/mserver5--help.stable.err
        monetdb5/tools/Tests/mserver5--help.stable.err.Windows
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_cast.c
        sql/backends/monet5/sql_cast_impl_down_from_flt.h
        sql/backends/monet5/sql_round_impl.h
        sql/server/sql_mvc.c
        sql/server/sql_parser.y
        sql/storage/bat/bat_logger.c
        sql/storage/bat/bat_logger.h
        sql/storage/sql_storage.h
        sql/storage/store.c
        sql/test/ADT2006/Tests/sander.stable.err
        sql/test/BugTracker-2018/Tests/All
        testing/Mtest.py.in
        testing/README
        testing/process.py
        tools/mserver/mserver5.1.in
        tools/mserver/mserver5.c
Branch: analytics
Log Message:

Merge with default.


diffs (truncated from 3107 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -112,6 +112,7 @@ Vendor: MonetDB BV <i...@monetdb.org>
 Group: Applications/Databases
 License: MPLv2.0
 URL: https://www.monetdb.org/
+BugURL: https://bugs.monetdb.org/
 Source: 
https://www.monetdb.org/downloads/sources/Aug2018-SP1/%{name}-%{version}.tar.bz2
 
 # we need systemd for the _unitdir macro to exist
@@ -1080,7 +1081,7 @@ done
 * Wed Oct  3 2018 Sjoerd Mullender <sjo...@acm.org> - 11.31.9-20181005
 - buildtools: On Ubuntu 18.10 (Cosmic Cuttlefish), the libmonetdb5-server-bam 
package
   cannot be built because of an incompatibility in the libbam library
-  (it cannot be used in a shared object.
+  (it cannot be used in a shared object).
 
 * Wed Aug 29 2018 Sjoerd Mullender <sjo...@acm.org> - 11.31.7-20180829
 - Rebuilt.
diff --git a/buildtools/ChangeLog-Archive b/buildtools/ChangeLog-Archive
--- a/buildtools/ChangeLog-Archive
+++ b/buildtools/ChangeLog-Archive
@@ -4,7 +4,7 @@
 * Wed Oct  3 2018 Sjoerd Mullender <sjo...@acm.org> - 11.31.9-20181005
 - On Ubuntu 18.10 (Cosmic Cuttlefish), the libmonetdb5-server-bam package
   cannot be built because of an incompatibility in the libbam library
-  (it cannot be used in a shared object.
+  (it cannot be used in a shared object).
 
 * Tue Aug 28 2018 Sjoerd Mullender <sjo...@acm.org> - 11.31.5-20180829
 - Build the MonetDB-cfitsio RPM and libmonetdb5-server-cfitsio
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
@@ -432,9 +432,8 @@ gdk_return log_tend(logger *lg);
 gdk_return log_tstart(logger *lg);
 gdk_return logger_add_bat(logger *lg, BAT *b, const char *name, char tpe, oid 
id) __attribute__((__warn_unused_result__));
 lng logger_changes(logger *lg);
-gdk_return logger_cleanup(logger *lg, int keep_persisted_log_files);
-logger *logger_create(int debug, const char *fn, const char *logdir, int 
version, preversionfix_fptr prefuncp, postversionfix_fptr postfuncp, int 
keep_persisted_log_files);
-logger *logger_create_shared(int debug, const char *fn, const char *logdir, 
const char *slave_logdir, int version, preversionfix_fptr prefuncp, 
postversionfix_fptr postfuncp);
+gdk_return logger_cleanup(logger *lg);
+logger *logger_create(int debug, const char *fn, const char *logdir, int 
version, preversionfix_fptr prefuncp, postversionfix_fptr postfuncp);
 gdk_return logger_del_bat(logger *lg, log_bid bid) 
__attribute__((__warn_unused_result__));
 void logger_destroy(logger *lg);
 gdk_return logger_exit(logger *lg);
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -685,16 +685,18 @@ static int
 dump_column_definition(Mapi mid, stream *toConsole, const char *schema, const 
char *tname, const char *tid, bool foreign, bool hashge)
 {
        MapiHdl hdl = NULL;
-       char *query;
-       size_t maxquerylen;
+       char *query = NULL;
+       size_t maxquerylen = 1024;
        int cnt;
        int slen;
        int cap;
 #define CAP(X) ((cap = (int) (X)) < 0 ? 0 : cap)
 
-       maxquerylen = 1024;
-       if (tid == NULL)
+       if (tid == NULL) {
+               if (tname == NULL || schema == NULL)
+                       return 1;
                maxquerylen += strlen(tname) + strlen(schema);
+       }
        else
                maxquerylen += strlen(tid);
        if ((query = malloc(maxquerylen)) == NULL)
@@ -713,7 +715,7 @@ dump_column_definition(Mapi mid, stream 
                                "c.number "             /* 6 */
                         "FROM sys._columns c "
                         "WHERE c.table_id = %s "
-                        "ORDER BY number", tid);
+                        "ORDER BY c.number", tid);
        else
                snprintf(query, maxquerylen,
                         "SELECT c.name, "              /* 0 */
@@ -730,7 +732,7 @@ dump_column_definition(Mapi mid, stream 
                               "'%s' = t.name AND "
                               "t.schema_id = s.id AND "
                               "s.name = '%s' "
-                        "ORDER BY number", tname, schema);
+                        "ORDER BY c.number", tname, schema);
        if ((hdl = mapi_query(mid, query)) == NULL || mapi_error(mid))
                goto bailout;
 
@@ -785,7 +787,7 @@ dump_column_definition(Mapi mid, stream 
                         "WHERE kc.id = k.id AND "
                               "k.table_id = %s AND "
                               "k.type = 0 "
-                        "ORDER BY id, nr", tid);
+                        "ORDER BY k.id, kc.nr", tid);
        else
                snprintf(query, maxquerylen,
                         "SELECT kc.name, "             /* 0 */
@@ -802,7 +804,7 @@ dump_column_definition(Mapi mid, stream 
                               "t.schema_id = s.id AND "
                               "s.name = '%s' AND "
                               "t.name = '%s' "
-                        "ORDER BY id, nr", schema, tname);
+                        "ORDER BY k.id, kc.nr", schema, tname);
        if ((hdl = mapi_query(mid, query)) == NULL || mapi_error(mid))
                goto bailout;
        cnt = 0;
@@ -844,7 +846,7 @@ dump_column_definition(Mapi mid, stream 
                         "WHERE kc.id = k.id AND "
                               "k.table_id = %s AND "
                               "k.type = 1 "
-                        "ORDER BY id, nr", tid);
+                        "ORDER BY k.id, kc.nr", tid);
        else
                snprintf(query, maxquerylen,
                         "SELECT kc.name, "             /* 0 */
@@ -861,7 +863,7 @@ dump_column_definition(Mapi mid, stream 
                               "t.schema_id = s.id AND "
                               "s.name = '%s' AND "
                               "t.name = '%s' "
-                        "ORDER BY id, nr", schema, tname);
+                        "ORDER BY k.id, kc.nr", schema, tname);
        if ((hdl = mapi_query(mid, query)) == NULL || mapi_error(mid))
                goto bailout;
        cnt = 0;
@@ -925,7 +927,7 @@ describe_table(Mapi mid, const char *sch
 {
        int cnt, table_id = 0;
        MapiHdl hdl = NULL;
-       char *query;
+       char *query = NULL;
        char *view = NULL;
        char *remark = NULL;
        int type = 0;
@@ -939,6 +941,8 @@ describe_table(Mapi mid, const char *sch
                        size_t len = sname - tname;
 
                        sname = malloc(len + 1);
+                       if (sname == NULL)
+                               return 1;
                        strncpy(sname, tname, len);
                        sname[len] = 0;
                        tname += len + 1;
@@ -951,8 +955,13 @@ describe_table(Mapi mid, const char *sch
        hashge = has_hugeint(mid);
 
        maxquerylen = 5120 + strlen(tname) + strlen(schema);
+       query = malloc(maxquerylen);
+       if (query == NULL) {
+               if (sname != NULL)
+                       free(sname);
+               return 1;
+       }
 
-       query = malloc(maxquerylen);
        snprintf(query, maxquerylen,
                 "%s "
                 "SELECT t.name, t.query, t.type, t.id, c.remark "
@@ -1102,7 +1111,7 @@ describe_table(Mapi mid, const char *sch
                                "c.name, "              /* 3 */
                                "i.type "               /* 4 */
                         "FROM sys.idxs AS i "
-                               "LEFT JOIN sys.keys AS k ON i.name = k.name, "
+                               "LEFT JOIN sys.keys AS k ON i.name = k.name, "
                              "sys.objects AS kc, "
                              "sys._columns AS c, "
                              "sys.schemas s, "
@@ -1194,7 +1203,7 @@ describe_table(Mapi mid, const char *sch
                 "FROM sys._columns col, comments com "
                 "WHERE col.id = com.id "
                   "AND col.table_id = (SELECT id FROM sys._tables WHERE 
schema_id = (SELECT id FROM sys.schemas WHERE name = '%s') AND name = '%s') "
-                "ORDER BY number",
+                "ORDER BY col.number",
                 comments_clause,
                 schema, tname);
        if ((hdl = mapi_query(mid, query)) == NULL || mapi_error(mid))
@@ -1253,6 +1262,8 @@ describe_sequence(Mapi mid, const char *
                        size_t len = sname - tname;
 
                        sname = malloc(len + 1);
+                       if (sname == NULL)
+                               return 1;
                        strncpy(sname, tname, len);
                        sname[len] = 0;
                        tname += len + 1;
@@ -1265,6 +1276,12 @@ describe_sequence(Mapi mid, const char *
        maxquerylen = 5120 + strlen(tname) + strlen(schema);
 
        query = malloc(maxquerylen);
+       if (query == NULL) {
+               if (sname != NULL)
+                       free(sname);
+               return 1;
+       }
+
        snprintf(query, maxquerylen,
                "%s "
                "SELECT s.name, "
@@ -1473,11 +1490,12 @@ dump_table_data(Mapi mid, const char *sc
        if (string == NULL)
                goto bailout;
        for (i = 0; i < cnt; i++) {
-               string[i] = (strcmp(mapi_get_type(hdl, i), "char") == 0 ||
-                            strcmp(mapi_get_type(hdl, i), "varchar") == 0 ||
-                            strcmp(mapi_get_type(hdl, i), "clob") == 0 ||
-                            strcmp(mapi_get_type(hdl, i), "timestamp") == 0 ||
-                            strcmp(mapi_get_type(hdl, i), "timestamptz") == 0);
+               const char *tp = mapi_get_type(hdl, i);
+               string[i] = (strcmp(tp, "char") == 0 ||
+                            strcmp(tp, "varchar") == 0 ||
+                            strcmp(tp, "clob") == 0 ||
+                            strcmp(tp, "timestamp") == 0 ||
+                            strcmp(tp, "timestamptz") == 0);
        }
        while (mapi_fetch_row(hdl)) {
                const char *s;
@@ -1807,6 +1825,8 @@ dump_functions(Mapi mid, stream *toConso
                                size_t len = dot - fname;
 
                                to_free = malloc(len + 1);
+                               if (to_free == NULL)
+                                       return 1;
                                strncpy(to_free, fname, len);
                                to_free[len] = 0;
                                fname += len + 1;
@@ -1824,7 +1844,7 @@ dump_functions(Mapi mid, stream *toConso
        query_size = 5120 + (sname ? strlen(sname) : 0) + (fname ? 
strlen(fname) : 0);
        query = malloc(query_size);
        if (query == NULL) {
-               if (to_free)
+               if (to_free != NULL)
                        free(to_free);
                return 1;
        }
@@ -1899,7 +1919,7 @@ dump_functions(Mapi mid, stream *toConso
 int
 dump_database(Mapi mid, stream *toConsole, int describe, bool useInserts)
 {
-       const char *start = "START TRANSACTION";
+       const char *start_trx = "START TRANSACTION";
        const char *end = "ROLLBACK";
        const char *users =
                "SELECT ui.name, "
@@ -2027,7 +2047,7 @@ dump_database(Mapi mid, stream *toConsol
                     "sys.schemas s "
                "WHERE s.id = seq.schema_id "
                "ORDER BY s.name, seq.name";
-       /* we must dump tables, views, procedures and triggers in order of 
creation since they can refer to each other */
+       /* we must dump tables, views, functions/procedures and triggers in 
order of creation since they can refer to each other */
        const char *tables_views_functions_triggers =
                has_funcsys(mid) ?
                ", vft (sname, name, id, query, remark, type) AS ("
@@ -2035,7 +2055,7 @@ dump_database(Mapi mid, stream *toConsol
                               "t.name AS name, "
                               "t.id AS id, "
                               "NULL AS query, "
-                              "NULL AS remark, "
+                              "NULL AS remark, " /* emitted separately */
                               "t.type AS type "
                        "FROM sys.schemas s, "
                              "sys._tables t "
@@ -2043,7 +2063,7 @@ dump_database(Mapi mid, stream *toConsol
                              "t.system = FALSE AND "
                              "s.id = t.schema_id AND "
                              "s.name <> 'tmp' "
-                       "UNION "
+                       "UNION ALL "
                        "SELECT s.name AS sname, " /* views */
                               "t.name AS name, "
                               "t.id AS id, "
@@ -2056,8 +2076,8 @@ dump_database(Mapi mid, stream *toConsol
                              "t.system = FALSE AND "
                              "s.id = t.schema_id AND "
                              "s.name <> 'tmp' "
-                       "UNION "
-                       "SELECT s.name AS sname, " /* functions */
+                       "UNION ALL "
+                       "SELECT s.name AS sname, " /* functions and procedures 
*/
                               "f.name AS name, "
                               "f.id AS id, "
                               "NULL AS query, "
@@ -2067,7 +2087,7 @@ dump_database(Mapi mid, stream *toConsol
                             "sys.functions f "
                        "WHERE s.id = f.schema_id "
                        "AND NOT f.system "
-                       "UNION "
+                       "UNION ALL "
                        "SELECT s.name AS sname, " /* triggers */
                               "tr.name AS name, "
                               "tr.id AS id, "
@@ -2087,7 +2107,7 @@ dump_database(Mapi mid, stream *toConsol
                               "t.name AS name, "
                               "t.id AS id, "
                               "NULL AS query, "
-                              "NULL AS remark, "
+                              "NULL AS remark, " /* emitted separately */
                               "t.type AS type "
                        "FROM sys.schemas s, "
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to