Changeset: b0f330977ec8 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b0f330977ec8 Modified Files: sql/backends/monet5/rel_bin.c sql/server/rel_select.c sql/test/miscellaneous/Tests/groupby_error.stable.out sql/test/subquery/Tests/subquery6.stable.err Branch: Oct2020 Log Message:
fixed issue with regrouping for distinct within aggregates approved output diffs (60 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 @@ -1112,11 +1112,13 @@ exp_bin(backend *be, sql_exp *e, stmt *l list *nl = sa_list(sql->sa); stmt *ngrp = grp; stmt *next = ext; + stmt *ncnt = cnt; for (en = l->h; en; en = en->next) { stmt *as = en->data; - stmt *g = stmt_group(be, as, ngrp, next, cnt, 1); + stmt *g = stmt_group(be, as, ngrp, next, ncnt, 1); ngrp = stmt_result(be, g, 0); next = stmt_result(be, g, 1); + ncnt = stmt_result(be, g, 2); } for (en = l->h; en; en = en->next) { stmt *as = en->data; 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 @@ -5420,7 +5420,7 @@ rel_select_exp(sql_query *query, sql_rel for (node *n=pexps->h; n; n = n->next) { sql_exp *ce = n->data; if (rel->card < ce->card) { - if (exp_name(ce)) { + if (exp_name(ce) && !has_label(ce)) { return sql_error(sql, ERR_GROUPBY, SQLSTATE(42000) "SELECT: cannot use non GROUP BY column '%s' in query results without an aggregate function", exp_name(ce)); } else { return sql_error(sql, ERR_GROUPBY, SQLSTATE(42000) "SELECT: cannot use non GROUP BY column in query results without an aggregate function"); diff --git a/sql/test/miscellaneous/Tests/groupby_error.stable.out b/sql/test/miscellaneous/Tests/groupby_error.stable.out --- a/sql/test/miscellaneous/Tests/groupby_error.stable.out +++ b/sql/test/miscellaneous/Tests/groupby_error.stable.out @@ -513,6 +513,12 @@ project ( [ "0" ] [ "0" ] [ "81" ] +#select group_concat(distinct col1, col2) from tab0; +% sys.%1 # table_name +% %1 # name +% clob # type +% 8 # length +[ "07902481" ] #ROLLBACK; #START TRANSACTION; #CREATE TABLE tab2 ("col0" INTEGER,"col1" INTEGER,"col2" INTEGER); diff --git a/sql/test/subquery/Tests/subquery6.stable.err b/sql/test/subquery/Tests/subquery6.stable.err --- a/sql/test/subquery/Tests/subquery6.stable.err +++ b/sql/test/subquery/Tests/subquery6.stable.err @@ -74,6 +74,10 @@ MAPI = (monetdb) /var/tmp/mtest-214995/ QUERY = select min(i) as myx from integers group by myx; ERROR = !MIN: aggregate function 'min' not allowed in GROUP BY clause CODE = 42000 +MAPI = (monetdb) /var/tmp/mtest-429967/.s.monetdb.36971 +QUERY = select ntile(i) over (), count(*) from integers; +ERROR = !SELECT: cannot use non GROUP BY column in query results without an aggregate function +CODE = 42000 # 11:45:43 > # 11:45:43 > "Done." _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list