`countRows` is simply the string `COUNT(*)`, `makeSelect` always emits `SELECT DISTINCT`. Thus the following invalid SQL is produced: > SELECT DISTINCT COUNT(*) FROM table; Ideally `makeSelect` would be somewhat smart and automagically form the correct `SELECT COUNT(DISTINCT *)`. My guess is we would have to treat `countRows` somewhat more special, than we do currently.