Changeset: 5d0a72ab8c3e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5d0a72ab8c3e
Modified Files:
        monetdb5/optimizer/opt_pipes.c
        sql/backends/monet5/sql_statement.c
        sql/backends/monet5/sql_statement.h
Branch: dict
Log Message:

merged with default


diffs (91 lines):

diff --git a/sql/ChangeLog b/sql/ChangeLog
--- a/sql/ChangeLog
+++ b/sql/ChangeLog
@@ -6,13 +6,6 @@
   view sys.fkeys to provide user friendly querying of existing foreign
   keys and their ON UPDATE and ON DELETE referential action specifications.
 
-* Mon Oct 18 2021 Pedro Ferreira <pedro.ferre...@monetdbsolutions.com>
-- The COPY INTO command would use the double quote as the default string
-  delimiter to produce output, while COPY FROM would use the empty string.
-  As a consequence, this created incompatibility between the two commands
-  when using default values from the parser. As a solution, the COPY INTO
-  command changed to use the empty string as the default string delimiter.
-
 * Tue Oct 12 2021 Pedro Ferreira <pedro.ferre...@monetdbsolutions.com>
 - Many improvements were done for REMOTE table plans. As a consequence,
   master or slave servers from this feature release are not compatible
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -4004,7 +4004,8 @@ stmt_cond(backend *be, stmt *cond, stmt 
                        freeInstruction(q);
                        return NULL;
                }
-               s->flag = loop;
+               s->flag = be->mvc_var; /* keep the mvc_var of the outer context 
*/
+               s->loop = loop;
                s->op1 = cond;
                s->nr = getArg(q, 0);
                return s;
@@ -4021,7 +4022,7 @@ stmt_control_end(backend *be, stmt *cond
        if (cond->nr < 0)
                return NULL;
 
-       if (cond->flag) {       /* while */
+       if (cond->loop) {       /* while */
                /* redo barrier */
                q = newAssignment(mb);
                if (q == NULL)
@@ -4040,10 +4041,7 @@ stmt_control_end(backend *be, stmt *cond
                q->argc = q->retc = 1;
                q->barrier = EXITsymbol;
        }
-       q = newStmt(mb, sqlRef, mvcRef);
-       if (q == NULL)
-               return NULL;
-       be->mvc_var = getDestVar(q);
+       be->mvc_var = cond->flag; /* restore old mvc_var from before the 
barrier */
        stmt *s = stmt_create(be->mvc->sa, st_control_end);
        if(!s) {
                freeInstruction(q);
diff --git a/sql/backends/monet5/sql_statement.h 
b/sql/backends/monet5/sql_statement.h
--- a/sql/backends/monet5/sql_statement.h
+++ b/sql/backends/monet5/sql_statement.h
@@ -119,7 +119,8 @@ typedef struct stmt {
         key:1,                 /* key (aka all values are unique) */ // TODO 
make this thing a bool
         aggr:1,                /* aggregated */
         partition:1,   /* selected as mitosis candidate */
-        reduce:1;              /* used to reduce number of rows (also for 
joins) */
+        reduce:1,              /* used to reduce number of rows (also for 
joins) */
+        loop:1;                /* cond statement is looping */
 
        struct stmt *cand;      /* optional candidate list */
 
diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c
--- a/sql/server/rel_updates.c
+++ b/sql/server/rel_updates.c
@@ -1843,7 +1843,7 @@ copyto(sql_query *query, symbol *sq, con
        mvc *sql = query->sql;
        const char *tsep = seps->h->data.sval;
        const char *rsep = seps->h->next->data.sval;
-       const char *ssep = 
(seps->h->next->next)?seps->h->next->next->data.sval:NULL;
+       const char *ssep = 
(seps->h->next->next)?seps->h->next->next->data.sval:"\"";
        const char *ns = (null_string)?null_string:"null";
        sql_exp *tsep_e, *rsep_e, *ssep_e, *ns_e, *fname_e, *oncl_e;
        exp_kind ek = {type_value, card_relation, TRUE};
diff --git a/sql/test/BugTracker-2021/Tests/copyinto-copyfrom.Bug-7186.SQL.py 
b/sql/test/BugTracker-2021/Tests/copyinto-copyfrom.Bug-7186.SQL.py
--- a/sql/test/BugTracker-2021/Tests/copyinto-copyfrom.Bug-7186.SQL.py
+++ b/sql/test/BugTracker-2021/Tests/copyinto-copyfrom.Bug-7186.SQL.py
@@ -13,9 +13,9 @@ try:
         CREATE TABLE "t" ("id" INTEGER,"name" VARCHAR(1024),"schema_id" 
INTEGER,"query" VARCHAR(1048576),"type" SMALLINT,"system" 
BOOLEAN,"commit_action" SMALLINT,"access" SMALLINT,"temporary" TINYINT);
         """).assertSucceeded()
         cli.execute("""
-        COPY SELECT 
"id","name","schema_id","query","type","system","commit_action","access","temporary"
 FROM sys.tables LIMIT 100 INTO '%s' DELIMITERS '|';
+        COPY SELECT 
"id","name","schema_id","query","type","system","commit_action","access","temporary"
 FROM sys.tables LIMIT 100 INTO '%s' USING DELIMITERS '|',E'\n','"';
         """ % (temp_name)).assertSucceeded()
-        cli.execute("COPY INTO t FROM '%s' DELIMITERS '|';" % 
(temp_name)).assertSucceeded()
+        cli.execute("COPY INTO t FROM '%s' USING DELIMITERS '|',E'\\n','\"';" 
% (temp_name)).assertSucceeded()
         cli.execute("DROP TABLE t;").assertSucceeded()
         cli.execute("ROLLBACK;").assertSucceeded()
 finally:
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to