Hi Tony. Good. Yes, simpler test case is always better when posting possible bugs.
Unfortunately, as Cezary points out, this error is by design (from select.c): if( pFunc->iDistinct>=0 ){ Expr *pE = pFunc->pExpr; assert( !ExprHasProperty(pE, EP_xIsSelect) ); if( pE->x.pList==0 || pE->x.pList->nExpr!=1 ){ sqlite3ErrorMsg(pParse, "DISTINCT aggregates must have exactly one " "argument"); pFunc->iDistinct = -1; }else{ It would be interesting to understand the harm avoided by disallowing DISTINCT scope of all the aggregate parameters. Probably slower, but what else? Usually, there is a comment in the source but not for this one. Peter On Tue, Jan 2, 2018 at 2:54 PM, Tony Papadimitriou <to...@acm.org> wrote: > Even simpler, then... > select group_concat(distinct 1,','); > > -----Original Message----- From: petern > Simpler one line test case also parses incorrectly: > > WITH t(c) AS (VALUES (1)) SELECT group_concat(DISTINCT c) FROM t; > "group_concat(DISTINCT c)" > 1 > > WITH t(c) AS (VALUES (1)) SELECT group_concat(DISTINCT c,',') FROM t; > Error: DISTINCT aggregates must have exactly one argument > > > On Tue, Jan 2, 2018 at 12:36 PM, Tony Papadimitriou <to...@acm.org> wrote: > > create table t(s); >> insert into t values ('A'),('A'),('B'); >> >> select group_concat(s,', ') from t group by null; -- OK >> select group_concat(distinct s) from t group by null; -- OK >> select group_concat(distinct s,', ') from t group by null; -- ERROR >> >> -- The moment the optional delimiter is given along with DISTINCT you get >> this error: >> -- Error: near line 6: DISTINCT aggregates must have exactly one argument >> >> -- Thank you. >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users@mailinglists.sqlite.org >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >> >> _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users