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

Adding `OVER()` to a `SELECT` clause #156

Open felixSchl opened 7 years ago

felixSchl commented 7 years ago

In essence I need the following query SELECT COUNT(*) FROM ... to read SELECT COUNT(*) OVER() FROM ... in order to get correct count results. I've been up and down the sources by now and see no way of achieving it with what's currently available. I can see this not being added to Esqueleto as it would open up a can of worms, so I wonder what options do I have at this point? The only thing I can think of is writing a view at db layer and then using that but that would come at the expense of losing type safety. Any help would be greatly appreciated :)

Edit: I am working with postgres.