Changeset: ea6749b0f655 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ea6749b0f655
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/mapiclient/dump.c
        clients/mapiclient/mclient.1
        clients/mapilib/mapi.c
        clients/odbc/driver/SQLPrepare.c
        gdk/gdk.h
        gdk/gdk_atoms.h
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_calc.c
        gdk/gdk_firstn.c
        gdk/gdk_heap.c
        gdk/gdk_imprints.c
        gdk/gdk_join.c
        gdk/gdk_logger.c
        gdk/gdk_private.h
        gdk/gdk_select.c
        gdk/gdk_storage.c
        gdk/gdk_string.c
        gdk/gdk_utils.c
        gdk/gdk_value.c
        monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out
        
monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.Windows
        monetdb5/extras/rapi/converters.c.h
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_interpreter.c
        monetdb5/modules/kernel/algebra.mal
        sql/backends/monet5/UDF/pyapi/pyheader.h
        testing/Mfilter.py
        testing/difflib.c
        tools/merovingian/client/monetdb.c
        tools/merovingian/daemon/client.c
        tools/merovingian/daemon/connections.c
        tools/merovingian/daemon/controlrunner.c
        tools/merovingian/daemon/forkmserver.c
        tools/merovingian/daemon/multiplex-funnel.c
        tools/merovingian/daemon/proxy.c
        tools/merovingian/utils/control.c
        tools/merovingian/utils/utils.c
Branch: default
Log Message:

Merge with Nov2019 branch.


diffs (truncated from 1294 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -589,15 +589,15 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:int, 
y:int):bat[:any_1] ",      "ALGslice_int;",        "Return the slice with the 
BUNs at position x till y."  ]
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:lng, 
y:lng):bat[:any_1] ",      "ALGslice_lng;",        "Return the slice with the 
BUNs at position x till y."  ]
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:oid, 
y:oid):bat[:any_1] ",      "ALGslice_oid;",        "Return the slice based on 
head oid x till y (exclusive)."      ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit):bat[:any_1] ",      "ALGsort11;",   "Returns a copy 
of the BAT sorted on tail values.\n         The input and output are (must be) 
dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ", "ALGsort12;",   
"Returns a copy of the BAT sorted on tail values and a BAT that\n         
specifies how the input was reordered.\n         The input and output are (must 
be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid]) ",  
"ALGsort13;",   "Returns a copy of the BAT sorted on tail values, a BAT that 
specifies\n         how the input was reordered, and a BAT with group 
information.\n         The input and output are (must be) dense headed.\n       
  The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."  ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ", "ALGsort21;",   "Returns 
a copy of the BAT sorted on tail values.\n         The input and output are 
(must be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",    
"ALGsort22;",   "Returns a copy of the BAT sorted on tail values and a BAT 
that\n         specifies how the input was reordered.\n         The input and 
output are (must be) dense headed.\n         The order is descending if the 
reverse bit is set.\n\t\t This is a stable sort if the stable bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], 
X_2:bat[:oid]) ",     "ALGsort23;",   "Returns a copy of the BAT sorted on tail 
values, a BAT that specifies\n         how the input was reordered, and a BAT 
with group information.\n         The input and output are (must be) dense 
headed.\n         The order is descending if the reverse bit is set.\n\t\t This 
is a stable sort if the stable bit is set."  ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ",    
"ALGsort31;",   "Returns a copy of the BAT sorted on tail values.\n         The 
input and output are (must be) dense headed.\n         The order is descending 
if the reverse bit is set.\n\t\t This is a stable sort if the stable bit is 
set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid]) ",       "ALGsort32;",   "Returns a copy of the BAT sorted on 
tail values and a BAT that\n         specifies how the input was reordered.\n   
      The input and output are (must be) dense headed.\n         The order is 
descending if the reverse bit is set.\n\t\t This is a stable sort if the stable 
bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid], X_2:bat[:oid]) ",        "ALGsort33;",   "Returns a copy of the 
BAT sorted on tail values, a BAT that specifies\n         how the input was 
reordered, and a BAT with group information.\n         The input and output are 
(must be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."  ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit):bat[:any_1] ",      "ALGsort11;",   "Returns a copy 
of the BAT sorted on tail values.\n         The order is descending if the 
reverse bit is set.\n\t\t This is a stable sort if the stable bit is set."   ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ", "ALGsort12;",   
"Returns a copy of the BAT sorted on tail values and a BAT that\n         
specifies how the input was reordered.\n         The order is descending if the 
reverse bit is set.\n\t\t This is a stable sort if the stable bit is set."    ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid]) ",  
"ALGsort13;",   "Returns a copy of the BAT sorted on tail values, a BAT that 
specifies\n         how the input was reordered, and a BAT with group 
information.\n         The order is descending if the reverse bit is set.\n\t\t 
This is a stable sort if the stable bit is set."     ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ", "ALGsort21;",   "Returns 
a copy of the BAT sorted on tail values.\n         The order is descending if 
the reverse bit is set.\n\t\t This is a stable sort if the stable bit is set."  
 ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",    
"ALGsort22;",   "Returns a copy of the BAT sorted on tail values and a BAT 
that\n         specifies how the input was reordered.\n         The order is 
descending if the reverse bit is set.\n\t\t This is a stable sort if the stable 
bit is set."    ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], 
X_2:bat[:oid]) ",     "ALGsort23;",   "Returns a copy of the BAT sorted on tail 
values, a BAT that specifies\n         how the input was reordered, and a BAT 
with group information.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."     ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ",    
"ALGsort31;",   "Returns a copy of the BAT sorted on tail values.\n         The 
order is descending if the reverse bit is set.\n\t\t This is a stable sort if 
the stable bit is set."   ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid]) ",       "ALGsort32;",   "Returns a copy of the BAT sorted on 
tail values and a BAT that\n         specifies how the input was reordered.\n   
      The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."    ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid], X_2:bat[:oid]) ",        "ALGsort33;",   "Returns a copy of the 
BAT sorted on tail values, a BAT that specifies\n         how the input was 
reordered, and a BAT with group information.\n         The order is descending 
if the reverse bit is set.\n\t\t This is a stable sort if the stable bit is 
set."     ]
 [ "algebra",   "subslice",     "command algebra.subslice(b:bat[:any_1], x:lng, 
y:lng):bat[:oid] ",     "ALGsubslice_lng;",     "Return the oids of the slice 
with the BUNs at position x till y."      ]
 [ "algebra",   "thetajoin",    "command algebra.thetajoin(l:bat[:any_1], 
r:bat[:any_1], sl:bat[:oid], sr:bat[:oid], op:int, nil_matches:bit, 
estimate:lng) (X_0:bat[:oid], X_1:bat[:oid]) ",   "ALGthetajoin;",        
"Theta join with candidate lists"       ]
 [ "algebra",   "thetaselect",  "command algebra.thetaselect(b:bat[:any_1], 
val:any_1, op:str):bat[:oid] ",     "ALGthetaselect1;",     "Select all head 
values for which the tail value obeys the relation\n\tvalue OP VAL.\n\tInput is 
a dense-headed BAT, output is a dense-headed BAT with in\n\tthe tail the head 
value of the input BAT for which the\n\trelationship holds.  The output BAT is 
sorted on the tail value."        ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -693,15 +693,15 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:int, 
y:int):bat[:any_1] ",      "ALGslice_int;",        "Return the slice with the 
BUNs at position x till y."  ]
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:lng, 
y:lng):bat[:any_1] ",      "ALGslice_lng;",        "Return the slice with the 
BUNs at position x till y."  ]
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:oid, 
y:oid):bat[:any_1] ",      "ALGslice_oid;",        "Return the slice based on 
head oid x till y (exclusive)."      ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit):bat[:any_1] ",      "ALGsort11;",   "Returns a copy 
of the BAT sorted on tail values.\n         The input and output are (must be) 
dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ", "ALGsort12;",   
"Returns a copy of the BAT sorted on tail values and a BAT that\n         
specifies how the input was reordered.\n         The input and output are (must 
be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid]) ",  
"ALGsort13;",   "Returns a copy of the BAT sorted on tail values, a BAT that 
specifies\n         how the input was reordered, and a BAT with group 
information.\n         The input and output are (must be) dense headed.\n       
  The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."  ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ", "ALGsort21;",   "Returns 
a copy of the BAT sorted on tail values.\n         The input and output are 
(must be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",    
"ALGsort22;",   "Returns a copy of the BAT sorted on tail values and a BAT 
that\n         specifies how the input was reordered.\n         The input and 
output are (must be) dense headed.\n         The order is descending if the 
reverse bit is set.\n\t\t This is a stable sort if the stable bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], 
X_2:bat[:oid]) ",     "ALGsort23;",   "Returns a copy of the BAT sorted on tail 
values, a BAT that specifies\n         how the input was reordered, and a BAT 
with group information.\n         The input and output are (must be) dense 
headed.\n         The order is descending if the reverse bit is set.\n\t\t This 
is a stable sort if the stable bit is set."  ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ",    
"ALGsort31;",   "Returns a copy of the BAT sorted on tail values.\n         The 
input and output are (must be) dense headed.\n         The order is descending 
if the reverse bit is set.\n\t\t This is a stable sort if the stable bit is 
set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid]) ",       "ALGsort32;",   "Returns a copy of the BAT sorted on 
tail values and a BAT that\n         specifies how the input was reordered.\n   
      The input and output are (must be) dense headed.\n         The order is 
descending if the reverse bit is set.\n\t\t This is a stable sort if the stable 
bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid], X_2:bat[:oid]) ",        "ALGsort33;",   "Returns a copy of the 
BAT sorted on tail values, a BAT that specifies\n         how the input was 
reordered, and a BAT with group information.\n         The input and output are 
(must be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."  ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit):bat[:any_1] ",      "ALGsort11;",   "Returns a copy 
of the BAT sorted on tail values.\n         The order is descending if the 
reverse bit is set.\n\t\t This is a stable sort if the stable bit is set."   ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ", "ALGsort12;",   
"Returns a copy of the BAT sorted on tail values and a BAT that\n         
specifies how the input was reordered.\n         The order is descending if the 
reverse bit is set.\n\t\t This is a stable sort if the stable bit is set."    ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid]) ",  
"ALGsort13;",   "Returns a copy of the BAT sorted on tail values, a BAT that 
specifies\n         how the input was reordered, and a BAT with group 
information.\n         The order is descending if the reverse bit is set.\n\t\t 
This is a stable sort if the stable bit is set."     ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ", "ALGsort21;",   "Returns 
a copy of the BAT sorted on tail values.\n         The order is descending if 
the reverse bit is set.\n\t\t This is a stable sort if the stable bit is set."  
 ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",    
"ALGsort22;",   "Returns a copy of the BAT sorted on tail values and a BAT 
that\n         specifies how the input was reordered.\n         The order is 
descending if the reverse bit is set.\n\t\t This is a stable sort if the stable 
bit is set."    ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], 
X_2:bat[:oid]) ",     "ALGsort23;",   "Returns a copy of the BAT sorted on tail 
values, a BAT that specifies\n         how the input was reordered, and a BAT 
with group information.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."     ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ",    
"ALGsort31;",   "Returns a copy of the BAT sorted on tail values.\n         The 
order is descending if the reverse bit is set.\n\t\t This is a stable sort if 
the stable bit is set."   ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid]) ",       "ALGsort32;",   "Returns a copy of the BAT sorted on 
tail values and a BAT that\n         specifies how the input was reordered.\n   
      The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."    ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid], X_2:bat[:oid]) ",        "ALGsort33;",   "Returns a copy of the 
BAT sorted on tail values, a BAT that specifies\n         how the input was 
reordered, and a BAT with group information.\n         The order is descending 
if the reverse bit is set.\n\t\t This is a stable sort if the stable bit is 
set."     ]
 [ "algebra",   "subslice",     "command algebra.subslice(b:bat[:any_1], x:lng, 
y:lng):bat[:oid] ",     "ALGsubslice_lng;",     "Return the oids of the slice 
with the BUNs at position x till y."      ]
 [ "algebra",   "thetajoin",    "command algebra.thetajoin(l:bat[:any_1], 
r:bat[:any_1], sl:bat[:oid], sr:bat[:oid], op:int, nil_matches:bit, 
estimate:lng) (X_0:bat[:oid], X_1:bat[:oid]) ",   "ALGthetajoin;",        
"Theta join with candidate lists"       ]
 [ "algebra",   "thetaselect",  "command algebra.thetaselect(b:bat[:any_1], 
val:any_1, op:str):bat[:oid] ",     "ALGthetaselect1;",     "Select all head 
values for which the tail value obeys the relation\n\tvalue OP VAL.\n\tInput is 
a dense-headed BAT, output is a dense-headed BAT with in\n\tthe tail the head 
value of the input BAT for which the\n\trelationship holds.  The output BAT is 
sorted on the tail value."        ]
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -434,8 +434,15 @@ dump_foreign_keys(Mapi mid, const char *
                char *t = sescape(tname);
                maxquerylen = 1024 + strlen(t) + strlen(s);
                query = malloc(maxquerylen);
-               if (query == NULL)
+               if (s == NULL || t == NULL || query == NULL) {
+                       if (s)
+                               free(s);
+                       if (t)
+                               free(t);
+                       if (query)
+                               free(query);
                        goto bailout;
+               }
                snprintf(query, maxquerylen,
                         "SELECT ps.name, "             /* 0 */
                                "pkt.name, "            /* 1 */
@@ -890,8 +897,13 @@ dump_column_definition(Mapi mid, stream 
        t = tname ? sescape(tname) : NULL;
        s = schema ? sescape(schema) : NULL;
        if (tid == NULL) {
-               if (tname == NULL || schema == NULL)
+               if (tname == NULL || schema == NULL) {
+                       if (t != NULL)
+                               free(t);
+                       if (s != NULL)
+                               free(s);
                        return 1;
+               }
                maxquerylen += 2 * strlen(tname) + 2 * strlen(schema);
        }
        else
@@ -1921,12 +1933,17 @@ dump_function(Mapi mid, stream *toConsol
                fname = strdup(fname);
                ftkey = strdup(ftkey);
 
-               if (!remark || !sname || !fname || !ftkey) {
-                       free(remark);
-                       free(sname);
-                       free(fname);
-                       free(ftkey);
-                       free(query);
+               if (remark == NULL || sname == NULL || fname == NULL || ftkey 
== NULL) {
+                       if (remark)
+                               free(remark);
+                       if (sname)
+                               free(sname);
+                       if (fname)
+                               free(fname);
+                       if (ftkey)
+                               free(ftkey);
+                       if (query)
+                               free(query);
                        goto bailout;
                }
        }
@@ -1953,8 +1970,7 @@ dump_function(Mapi mid, stream *toConsol
        }
        /* strdup these two because they are needed after another query */
        if (flkey) {
-               char* nflkey = flkey ? strdup(flkey) : NULL;
-               if (!nflkey) {
+               if ((flkey = strdup(flkey)) == NULL) {
                        if (remark) {
                                free(remark);
                                free(sname);
@@ -1962,8 +1978,7 @@ dump_function(Mapi mid, stream *toConsol
                                free(ftkey);
                        }
                        goto bailout;
-               } else
-                       flkey = nflkey;
+               }
        }
        ffunc = strdup(ffunc);
        query_len = snprintf(query, query_size,
@@ -2702,8 +2717,8 @@ dump_database(Mapi mid, stream *toConsol
        } else {
                mnstr_printf(toConsole, "SET SCHEMA ");
                dquoted_print(toConsole, sname, ";\n");
-               curschema = sname ? strdup(sname) : NULL;
-               if (sname && !curschema)
+               curschema = strdup(sname);
+               if (curschema == NULL)
                        goto bailout;
        }
 
diff --git a/clients/mapiclient/mclient.1 b/clients/mapiclient/mclient.1
--- a/clients/mapiclient/mclient.1
+++ b/clients/mapiclient/mclient.1
@@ -451,7 +451,7 @@ is the name of the table,
 .I $db
 is the name of the database.
 .PP
-mclient \-d $db \-s \(dqCOPY INTO $table FROM '$file' USING DELIMITERS 
',','\e\en','\e\(dq'\(dq
+mclient \-d $db \-s \(dqCOPY INTO $table FROM '$file' USING DELIMITERS 
',',E'\e\en','\e\(dq'\(dq
 .PP
 Efficiently import data from a CSV file into a table when the file is
 to be read by mclient (e.g. the server has no access to the file).
@@ -462,7 +462,7 @@ is the name of the table,
 .I $db
 is the name of the database.
 .PP
-mclient \-d $db \-s \(dqCOPY INTO $table FROM STDIN USING DELIMITERS 
',','\e\en','\e\(dq'\(dq \- < $file
+mclient \-d $db \-s \(dqCOPY INTO $table FROM STDIN USING DELIMITERS 
',',E'\e\en','\e\(dq'\(dq \- < $file
 .PP
 Note that in this latter case, if a count of records is supplied, it
 should be at least as large as the number of records actually present
@@ -471,10 +471,15 @@ This, because otherwise the remainder of
 as SQL queries.
 .PP
 Another, easier method to have the client read the file content is as
-follows.
+follows:
+.PP
+mclient \-d $db \-s \(dqCOPY INTO $table FROM '$file' ON CLIENT USING 
DELIMITERS ',',E'\e\en',\e\(dq'\(dq
 .PP
-mclient \-d $db \-s \(dqCOPY INTO $table FROM '$file' ON CLIENT USING 
DELIMITERS ',','\e\en',\e\(dq'\(dq
-.PP
+In this case the value of
+.I $file
+can be a path name relative to the directory in which
+.I mclient
+was started.
 If, in addition, the option
 .B \-\-allow\-remote
 is passed to
@@ -482,7 +487,9 @@ is passed to
 the
 .I $file
 in the above query can also be a URL.  It then has to have the form
-.IB schema :// string .
+.IB schema :// string ,
+.IR e . g .,
+.IR https://www.example.org/dumpdata.csv .
 .PP
 See https://www.monetdb.org/Documentation/Manuals/SQLreference/CopyInto
 for more information about the COPY INTO query.
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -2696,6 +2696,7 @@ mapi_reconnect(Mapi mid)
                                hash = malloc(len);
                                if (hash == NULL) {
                                        close_connection(mid);
+                                       free(pwh);
                                        return mapi_setError(mid, "malloc 
failure", "mapi_reconnect", MERROR);
                                }
                                snprintf(hash, len, "{%s}%s", *algs, pwh);
diff --git a/clients/odbc/driver/SQLPrepare.c b/clients/odbc/driver/SQLPrepare.c
--- a/clients/odbc/driver/SQLPrepare.c
+++ b/clients/odbc/driver/SQLPrepare.c
@@ -135,7 +135,11 @@ MNDBPrepare(ODBCStmt *stmt,
                int concise_type;
                int length, scale;
 
-               mapi_fetch_row(hdl);
+               if (mapi_fetch_row(hdl) == 0) {
+                       /* Memory allocation error (or maybe something else) */
+                       addStmtError(stmt, "HY001", 0, 0);
+                       return SQL_ERROR;
+               }
                if (ncols == 3 ||
                    (s = mapi_fetch_field(hdl, 5)) == NULL) {
                        /* either old prepare (i.e. old server) or no
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2301,6 +2301,7 @@ VALptr(const ValRecord *v)
 #ifdef HAVE_HGE
        case TYPE_hge: return (const void *) &v->val.hval;
 #endif
+       case TYPE_ptr: return (const void *) &v->val.pval;
        case TYPE_str: return (const void *) v->val.sval;
        default:       return (const void *) v->val.pval;
        }
diff --git a/gdk/gdk_atoms.h b/gdk/gdk_atoms.h
--- a/gdk/gdk_atoms.h
+++ b/gdk/gdk_atoms.h
@@ -327,9 +327,7 @@ ATOMreplaceVAR(int type, Heap *heap, var
 #define GDK_STRNIL(s)  ((s) == NULL || *(const char*) (s) == '\200')
 #define GDK_STRLEN(s)  ((GDK_STRNIL(s)?1:strlen(s))+1)
 #define GDK_STRCMP(l,r)        
(GDK_STRNIL(l)?(GDK_STRNIL(r)?0:-1):GDK_STRNIL(r)?1: \
-                        (*(const unsigned char*)(l) < *(const unsigned 
char*)(r))?-1: \
-                        (*(const unsigned char*)(l) > *(const unsigned 
char*)(r))?1: \
-                        strCmpNoNil((const unsigned char*)(l),(const unsigned 
char*)(r)))
+                        strcmp((const char*)(l), (const char*)(r)))
 
 static inline var_t
 VarHeapValRaw(const void *b, BUN p, int w)
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1816,6 +1816,10 @@ backup_new(Heap *hp, int lockbat)
        /* check for an existing X.new in BATDIR, BAKDIR and SUBDIR */
        batpath = GDKfilepath(hp->farmid, BATDIR, hp->filename, ".new");
        bakpath = GDKfilepath(hp->farmid, BAKDIR, hp->filename, ".new");
+       if (batpath == NULL || bakpath == NULL) {
+               ret = -1;
+               goto bailout;
+       }
        batret = stat(batpath, &st);
        bakret = stat(bakpath, &st);
 
@@ -1832,6 +1836,7 @@ backup_new(Heap *hp, int lockbat)
                        GDKsyserror("backup_new: remove %s failed\n", batpath);
                IODEBUG fprintf(stderr, "#%s: remove(%s) = %d\n", 
MT_thread_getname(), batpath, ret);
        }
+  bailout:
        GDKfree(batpath);
        GDKfree(bakpath);
        for (xx = lockbat; xx >= 0; xx--)
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -48,6 +48,10 @@ unshare_string_heap(BAT *b)
  * it makes sense to just quickly copy the whole string heap instead
  * of inserting individual strings.  See the comments in the code for
  * more information. */
+#ifdef STATIC_CODE_ANALYSIS
+#define rand()         0
+#endif
+
 static gdk_return
 insert_string_bat(BAT *b, BAT *n, BAT *s, bool force)
 {
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -403,6 +403,7 @@ fixfltheap(BAT *b)
        if (srcdir == NULL) {
                return GDK_FAIL;
        }
+       /* coverity[null_returns] */
        *strrchr(srcdir, DIR_SEP) = 0;
 
        if ((bnme = strrchr(nme, DIR_SEP)) != NULL)
@@ -691,6 +692,7 @@ fixdateheap(BAT *b, const char *anme)
        if (srcdir == NULL) {
                return GDK_FAIL;
        }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to