prowdsponsor / esqueleto

Bare bones, type-safe EDSL for SQL queries on persistent backends.
http://hackage.haskell.org/package/esqueleto
BSD 3-Clause "New" or "Revised" License
177 stars 51 forks source link

countRows does not work with distinct #157

Open gkleen opened 6 years ago

gkleen commented 6 years ago

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.

bitemyapp commented 6 years ago

Hello! This the original repository but active maintenance is happening over on my fork of Esqueleto. I've refiled your issue here: https://github.com/bitemyapp/esqueleto/issues/90