From: Peter G. <pe...@gm...> - 2008-04-03 04:48:25
|
Bjorn, I'm confused by the "unique" function. Why does it not just use SELECT DISTINCT <blah>? GROUP BY semantics are filthy. What is the intention with HaskellDB as far as safety goes? I have a query now that causes PostgreSQL to complain that I'm not doing enough GROUP BYing. I don't want to use GROUP BY at all, it's unnecessary for my query. (I actually want to use DISTINCT, but am busily hacking around needing either.) Where do these come from? I can easily send you the generated SQL but it is not easy to isolate the query itself; roughly I am trying to pass an aggregation function around and when I use it in a record construction I get this problem. Here's a plan: Add a new function: project' :: [Opt] -> ... blah, same as project where data Opt = DISTINCT | LIMIT Int | OFFSET Int I want to specify that these Opts apply to *this* projection, i.e. we need to track the column names passed to project'. I propose to do this by hacking the Project constructor in PrimQuery: data PrimQuery = ... | Project Assoc PrimQuery | ... becomes data PrimQuery = ... | Project [Opt] Assoc Assoc PrimQuery | ... The first Assoc is the specific fields the Opts apply to, the other assoc is as it is now. Hopefully the changes to SQL generation are obvious. Do you have an opinion on any of this? Is this on the right track? I definitely need LIMIT and OFFSET as they seem to be the only way to efficiently limit the result sets in HOPE. If you have other ideas, please share. Are you interested in fixing the UTF8 issues in HSQL and HaskellDB? If so, I'll send you some patches to HSQL, and later for HaskellDB. I've only hacked HSQL and HSQL-PostgreSQL, so it would need some love from someone else for the other backends. I can help with that, but have little time to do it myself. cheers pete |