You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
COUNT(DISTINCT *) is accepted and returns 1 for any number of rows #2758
COUNT(DISTINCT *) is accepted and returns 1. SQLite rejects it as a syntax error. Seen in the sqllogictest run (evidence/slt_lang_aggfunc.test), reproduced on develop (06211a0):
alasql('CREATE TABLE t1 (x INTEGER, y STRING)');alasql("INSERT INTO t1 VALUES (1, 'true'), (0, 'false'), (NULL, 'NULL')");alasql('SELECT COUNT(DISTINCT *) AS n FROM t1');// [{n: 1}] for three different rows
Fix (4.x)
Count the distinct rows: 3 here. The answer is wrong today, so counting distinct rows does not break anyone.
Not changed
COUNT(DISTINCT *) stays accepted. Making it a syntax error, as SQLite does, would break code that runs it today; at most it belongs in the sqlite dialect, and is not tracked separately.
Activity