From: Peter G. <pe...@gm...> - 2008-04-04 05:32:37
|
Justin, On 04/04/2008, at 12:08 AM, Justin Bailey wrote: > On Wed, Apr 2, 2008 at 9:48 PM, Peter Gammie <pe...@gm...> > wrote: >> I'm confused by the "unique" function. Why does it not just use >> SELECT >> DISTINCT <blah>? GROUP BY semantics are filthy. > > I can speak to unique, as I provided the patch which implemented it > (http://tinyurl.com/2u9hmf). When I started with haskelldb, it added > "distinct" to all queries. That behavior didn't work for what I wanted > to do. I coded unique so 'distinct' behavior was still accessible, but > wasn't the default. My experience with SQL has been to use GROUP BY > over DISTINCT, which is why it generates the code it does. What makes > GROUP BY filthy? It's filthy because it wasn't working for me. :-) I'm no SQL expert so I won't argue with you further. >> roughly I am trying to pass an aggregation function around and when I >> use it in a record construction I get this problem. > > I ran a problem when passing around aggregates recently that didn't > group quite correctly - the SQL was correct but the query result was > not. It's referenced in this email (http://tinyurl.com/33apbb) - are > you seeing the same thing? Sorry, the problem has been debugged out of existence, so I no longer know what precisely the problem was. In my case the SQL was definitely incorrect. I still have that (I think) if you want to see it. I've decided to abandon HaskellDB as there are just a few things I can't get it to do, and I'm running out of time. It's easier (and perhaps no less safe?) for me to just use HSQL directly. In any case the number of database accesses will be much reduced. Bjorn: I've added parameterised executions and queries to HSQL and HSQL/PostgreSQL. Do you want these patches? One advantage is that one does not need to do any string escaping. cheers peter |