Changeset: 56c49c745b4d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/56c49c745b4d Modified Files: sql/backends/monet5/rel_bin.c Branch: Jan2022 Log Message:
Merged with Jul2021 diffs (170 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -5769,7 +5769,7 @@ rel2bin_output(backend *be, sql_rel *rel const char *tsep, *rsep, *ssep, *ns, *fn = NULL; atom *tatom, *ratom, *satom, *natom; int onclient = 0; - stmt *s = NULL, *fns = NULL; + stmt *s = NULL, *fns = NULL, *res = NULL; list *slist = sa_list(sql->sa); if (rel->l) /* first construct the sub relation */ @@ -5797,11 +5797,15 @@ rel2bin_output(backend *be, sql_rel *rel } list_append(slist, stmt_export(be, s, tsep, rsep, ssep, ns, onclient, fns)); if (s->type == st_list && ((stmt*)s->op4.lval->h->data)->nrcols != 0) { - stmt *cnt = stmt_aggr(be, s->op4.lval->h->data, NULL, NULL, sql_bind_func(sql, "sys", "count", sql_bind_localtype("void"), NULL, F_AGGR), 1, 0, 1); - return cnt; + res = stmt_aggr(be, s->op4.lval->h->data, NULL, NULL, sql_bind_func(sql, "sys", "count", sql_bind_localtype("void"), NULL, F_AGGR), 1, 0, 1); } else { - return stmt_atom_lng(be, 1); - } + res = stmt_atom_lng(be, 1); + } + if (!be->silent) { + /* if there are multiple output statements, update total count, otherwise use the the current count */ + be->rowcount = be->rowcount ? add_to_rowcount_accumulator(be, res->nr) : res->nr; + } + return res; } static list * diff --git a/sql/test/BugTracker-2008/Tests/copy-count.SF-2485215.test b/sql/test/BugTracker-2008/Tests/copy-count.SF-2485215.test --- a/sql/test/BugTracker-2008/Tests/copy-count.SF-2485215.test +++ b/sql/test/BugTracker-2008/Tests/copy-count.SF-2485215.test @@ -4,13 +4,13 @@ start transaction statement ok create table t(i int) -statement ok +statement ok rowcount 1 insert into t values(1123) -statement ok +statement ok rowcount 1 copy select * from t into stdout using delimiters ',', E'\n' -statement ok +statement ok rowcount 1 copy select count(*) from t into stdout using delimiters ',', E'\n' statement ok diff --git a/sql/test/BugTracker-2011/Tests/copy-into-file-error.Bug-2722.test b/sql/test/BugTracker-2011/Tests/copy-into-file-error.Bug-2722.test --- a/sql/test/BugTracker-2011/Tests/copy-into-file-error.Bug-2722.test +++ b/sql/test/BugTracker-2011/Tests/copy-into-file-error.Bug-2722.test @@ -1,19 +1,19 @@ statement ok create table bug2722 (time timestamp, val int, fk int) -statement ok +statement ok rowcount 1 insert into bug2722 values (current_timestamp(), 1, 1) -statement ok +statement ok rowcount 1 insert into bug2722 values (current_timestamp(), 2, 2) -statement ok +statement ok rowcount 1 insert into bug2722 values (current_timestamp(), 3, 1) -statement ok +statement ok rowcount 1 insert into bug2722 values (current_timestamp(), 4, 2) -statement ok +statement ok rowcount 2 copy select val from bug2722 where fk=2 order by time into stdout using delimiters ' ' , E'\n' statement ok diff --git a/sql/test/BugTracker-2013/Tests/copy-out-quote.Bug-3393.test b/sql/test/BugTracker-2013/Tests/copy-out-quote.Bug-3393.test --- a/sql/test/BugTracker-2013/Tests/copy-out-quote.Bug-3393.test +++ b/sql/test/BugTracker-2013/Tests/copy-out-quote.Bug-3393.test @@ -4,13 +4,13 @@ start transaction statement ok create table table3393 (a clob, b clob) -statement ok +statement ok rowcount 1 insert into table3393 values ('one|two', 'three"four') -statement ok +statement ok rowcount 1 insert into table3393 values (E'five\tsix', E'seven\neight') -statement ok +statement ok rowcount 1 insert into table3393 values ('nine,ten', E'eleven\\twelve') query TT rowsort @@ -23,13 +23,13 @@ eleven\twelve one|two three"four -statement ok +statement ok rowcount 3 copy select * from table3393 into stdout delimiters ',', E'\n', '|' -statement ok +statement ok rowcount 3 copy select * from table3393 into stdout delimiters '|', E'\n', ',' -statement ok +statement ok rowcount 3 copy select * from table3393 into stdout statement ok diff --git a/sql/test/copy/Tests/null_as_string_output.test b/sql/test/copy/Tests/null_as_string_output.test --- a/sql/test/copy/Tests/null_as_string_output.test +++ b/sql/test/copy/Tests/null_as_string_output.test @@ -4,7 +4,7 @@ start transaction statement ok create table null_as_string (i int, s string, d decimal(5,2)) -statement ok +statement ok rowcount 4 copy 4 records into null_as_string from stdin delimiters ',',E'\n' NULL as '' <COPY_INTO_DATA> ,, @@ -12,13 +12,13 @@ copy 4 records into null_as_string from 1,,1 2,two, -statement ok +statement ok rowcount 4 copy select * from null_as_string into stdout delimiters ',',E'\n' NULL as '' statement ok delete from null_as_string -statement ok +statement ok rowcount 4 copy 4 records into null_as_string from stdin delimiters ',',E'\n' <COPY_INTO_DATA> NULL,NULL,NULL @@ -26,13 +26,13 @@ NULL,zero,0 1,NULL,1 2,two,NULL -statement ok +statement ok rowcount 4 copy select * from null_as_string into stdout delimiters ',',E'\n' statement ok delete from null_as_string -statement ok +statement ok rowcount 4 copy 4 records into null_as_string from stdin delimiters ',',E'\n' NULL as E'\\N' <COPY_INTO_DATA> \N,\N,\N @@ -40,7 +40,7 @@ copy 4 records into null_as_string from 1,\N,1 2,two,\N -statement ok +statement ok rowcount 4 copy select * from null_as_string into stdout delimiters ',',E'\n' NULL as E'\\N' statement ok _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org